CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
118 lines
4.0 KiB
YAML
118 lines
4.0 KiB
YAML
name: Unprivileged Download Artifact
|
|
description: >-
|
|
Download artifacts from another workflow run without using an access token.
|
|
inputs:
|
|
run-id:
|
|
description: >-
|
|
The run-id for the workflow run that you want to download the artifact
|
|
from. If ommitted it will download the most recently created artifact
|
|
from the repo with the artifact-name.
|
|
required: false
|
|
artifact-name:
|
|
desciption: The name of the artifact to download.
|
|
required: true
|
|
|
|
|
|
outputs:
|
|
filename:
|
|
description: >-
|
|
The filename of the downloaded artifact or the empty string if the
|
|
artifact was not found.
|
|
value: ${{ steps.download-artifact.outputs.filename }}
|
|
artifact-ids:
|
|
description: "The id of the artifact being downloaded."
|
|
value: ${{ steps.artifact-url.outputs.ids }}
|
|
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
env:
|
|
INPUTS_ARTIFACT_NAME: ${{ inputs.artifact-name }}
|
|
INPUTS_RUN_ID: ${{ inputs.run-id }}
|
|
id: artifact-url
|
|
with:
|
|
script: |
|
|
var response;
|
|
if (!process.env.INPUTS_RUN_ID) {
|
|
response = await github.rest.actions.listArtifactsForRepo({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
})
|
|
} else {
|
|
response = await github.rest.actions.listWorkflowRunArtifacts({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: process.env.INPUTS_RUN_ID,
|
|
})
|
|
}
|
|
|
|
console.log(response)
|
|
|
|
// Jobs rerun uploads fresh artifacts alongside the old ones with the
|
|
// same name, keep only the newest per name so downloads don't clobber.
|
|
latest_by_name = new Map()
|
|
for (artifact of response.data.artifacts) {
|
|
if (!artifact.name.startsWith(process.env.INPUTS_ARTIFACT_NAME)) {
|
|
continue
|
|
}
|
|
existing = latest_by_name.get(artifact.name)
|
|
if (!existing || new Date(artifact.created_at) > new Date(existing.created_at)) {
|
|
latest_by_name.set(artifact.name, artifact)
|
|
}
|
|
}
|
|
artifacts_to_download = Array.from(latest_by_name.values())
|
|
|
|
for (artifact of artifacts_to_download) {
|
|
console.log(artifact);
|
|
}
|
|
|
|
if (artifacts_to_download.length == 0) {
|
|
console.log(`Could not find artifacts starting with name ${process.env.INPUTS_ARTIFACT_NAME} for workflow run ${process.env.INPUTS_RUN_ID}`)
|
|
return;
|
|
}
|
|
|
|
artifact_ids = []
|
|
artifact_urls = []
|
|
artifact_names = []
|
|
for (artifact_to_download of artifacts_to_download) {
|
|
const url_response = await github.rest.actions.downloadArtifact({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
artifact_id: artifact_to_download.id,
|
|
archive_format: "zip"
|
|
})
|
|
|
|
artifact_ids.push(artifact_to_download.id)
|
|
artifact_urls.push(url_response.url)
|
|
artifact_names.push(artifact_to_download.name)
|
|
}
|
|
|
|
core.setOutput("urls", artifact_urls.join(" "));
|
|
core.setOutput("ids", artifact_ids.join(" "));
|
|
core.setOutput("names", artifact_names.join(" "));
|
|
|
|
- shell: bash
|
|
if: steps.artifact-url.outputs.urls != ''
|
|
id: download-artifact
|
|
env:
|
|
ARTIFACT_URLS: ${{ steps.artifact-url.outputs.urls }}
|
|
ARTIFACT_NAMES: ${{ steps.artifact-url.outputs.names }}
|
|
run: |
|
|
artifact_urls=($ARTIFACT_URLS)
|
|
artifact_names=($ARTIFACT_NAMES)
|
|
for i in "${!artifact_urls[@]}"; do
|
|
curl -L -o "${artifact_names[$i]}.zip" "${artifact_urls[$i]}"
|
|
done
|
|
|
|
- shell: bash
|
|
if: steps.artifact-url.outputs.names != ''
|
|
env:
|
|
ARTIFACT_NAMES: ${{ steps.artifact-url.outputs.names }}
|
|
run: |
|
|
artifact_names=($ARTIFACT_NAMES)
|
|
for name in "${artifact_names[@]}"; do
|
|
unzip "${name}.zip"
|
|
done
|