diff --git a/src/buildApi.ts b/src/buildApi.ts index 47c9393..2173df5 100644 --- a/src/buildApi.ts +++ b/src/buildApi.ts @@ -48,6 +48,18 @@ export default class BuildApi { return buildStatusResponse.data } + async createShareLink(buildtargetid: string, buildnumber: string) { + const shareEndpoint = `/orgs/${this.orgid}/projects/${this.projectid}/buildtargets/${buildtargetid}/builds/${buildnumber}/share` + const shareResponse = await this.apiPost(shareEndpoint, {}) + return shareResponse.data + } + + async getShareLink(buildtargetid: string, buildnumber: string) { + const shareEndpoint = `/orgs/${this.orgid}/projects/${this.projectid}/buildtargets/${buildtargetid}/builds/${buildnumber}/share` + const shareResponse = await this.apiGet(shareEndpoint) + return shareResponse.data + } + async apiGet(endpoint: string) { return await axios.get(this.apiUrl + endpoint, this.requestOptions) } diff --git a/src/main.ts b/src/main.ts index 9c44e86..dd80727 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,6 +18,13 @@ async function run(): Promise { const buildResult = await api.runBuild(buildtargetid) core.info(`Build finished!`) + core.setOutput('BuildResult', buildResult) + + core.info('Getting share link') + const shareResult = await api.createShareLink(buildtargetid, buildResult.build) + + core.info(`Share link: ${shareResult.shareid}`) + core.setOutput('share-link', shareResult.shareid) if (buildResult.buildStatus !== 'success') { core.setFailed(