-1

My step in workflow:

- uses: actions/upload-artifact@v4
  if: ${{ !cancelled() }}
  id: upload-artifact
  with:
    name: playwright-report
    path: |
        playwright-report/
        test-results
    retention-days: 10

generates following logs:

Multiple search paths detected. Calculating the least common ancestor of all paths
The least common ancestor is /runner/_work/repo_name_ts/repo_project_ts. This will be the root directory of the artifact
With the provided path, there will be 4 files uploaded
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 1258
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is 396c9a084637a965e45a4d198b57b96fd4fc95c5538c29c2c658604be62345352
Finalizing artifact upload
Artifact playwright-report.zip successfully finalized. Artifact ID 1682652411
Artifact playwright-report has been successfully uploaded! Final size is 1258 bytes. Artifact ID is 1682652410
Artifact download URL: https://github.com/my-space/my-repo`enter code here`/actions/runs/9859627431/artifacts/1682652411

I want to store download URL as variable and then use it in Teams notification in next step. How to grep these URL and store in variable for usage in next step?

1

1 Answer 1

1

You can use GitHub Artifacts API to get artifact ID and then compose the URL of the artifact. You can use GitHub CLI to simplify making HTTP calls. This simple step will give you artifact URL

- run: |
    ARTIFACT_ID=$(gh api /repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts | jq -r '.artifacts[0].id')

    ARTIFACT_URL= https://api.github.com/repos/$GITHUB_REPOSITORY/actions/artifacts/$ARTIFACT_ID/zip

Not the answer you're looking for? Browse other questions tagged or ask your own question.