Support artifact-url output (#496)

* Support artifact-url output

* update dist/index.js

* Update license

* Simplify output

* Update README
This commit is contained in:
Konrad Pabjan
2024-01-10 12:31:08 -05:00
committed by GitHub
parent c320f57948
commit 73d8b66ede
7 changed files with 4149 additions and 36 deletions

View File

@ -1,4 +1,5 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import artifact, {UploadArtifactOptions} from '@actions/artifact'
import {findFilesToUpload} from './search'
import {getInputs} from './input-helper'
@ -57,6 +58,12 @@ async function run(): Promise<void> {
`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
)
core.setOutput('artifact-id', uploadResponse.id)
const repository = github.context.repo
const artifactURL = `${github.context.serverUrl}/${repository.owner}/${repository.repo}/actions/runs/${github.context.runId}/artifacts/${uploadResponse.id}`
core.info(`Artifact download URL: ${artifactURL}`)
core.setOutput('artifact-url', artifactURL)
}
} catch (error) {
core.setFailed((error as Error).message)