[clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)
[llvm-project.git] / .github / workflows / unprivileged-download-artifact / action.yml
blob9d8fb59a67c0e130619f93537579212546873989
1 name: Unprivileged Download Artifact
2 description: >-
3   Download artifacts from another workflow run without using an access token.
4 inputs:
5   run-id:
6     description: >-
7       The run-id for the workflow run that you want to download the artifact
8       from.  If ommitted it will download the most recently created artifact
9       from the repo with the artifact-name.
10     required: false
11   artifact-name:
12     desciption: The name of the artifact to download.
13     required: true
16 outputs:
17   filename:
18     description: >-
19       The filename of the downloaded artifact or the empty string if the
20       artifact was not found.
21     value: ${{ steps.download-artifact.outputs.filename }}
22   artifact-id:
23     description: "The id of the artifact being downloaded."
24     value: ${{ steps.artifact-url.outputs.id }}
27 runs:
28   using: "composite"
29   steps:
30     - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
31       id: artifact-url
32       with:
33         script: |
34           var response;
35           if (!"${{ inputs.run-id }}") {
36             response = await github.rest.actions.listArtifactsForRepo({
37               owner: context.repo.owner,
38               repo: context.repo.repo,
39               name: "${{ inputs.artifact-name }}"
40             })
41           } else {
42             response = await github.rest.actions.listWorkflowRunArtifacts({
43               owner: context.repo.owner,
44               repo: context.repo.repo,
45               run_id: "${{ inputs.run-id }}",
46               name: "${{ inputs.artifact-name }}"
47             })
48           }
50           console.log(response)
52           for (artifact of response.data.artifacts) {
53             console.log(artifact);
54           }
56           if (response.data.artifacts.length == 0) {
57             console.log("Could not find artifact ${{ inputs.artifact-name }} for workflow run ${{ inputs.run-id }}")
58             return;
59           }
61           const url_response = await github.rest.actions.downloadArtifact({
62             owner: context.repo.owner,
63             repo: context.repo.repo,
64             artifact_id: response.data.artifacts[0].id,
65             archive_format: "zip"
66           })
68           core.setOutput("url", url_response.url);
69           core.setOutput("id", response.data.artifacts[0].id);
71     - shell: bash
72       if: steps.artifact-url.outputs.url != ''
73       id: download-artifact
74       run: |
75         curl -L -o ${{ inputs.artifact-name }}.zip "${{ steps.artifact-url.outputs.url }}"
76         echo "filename=${{ inputs.artifact-name }}.zip" >> $GITHUB_OUTPUT
78     - shell: bash
79       if: steps.download-artifact.outputs.filename != ''
80       run: |
81         unzip ${{ steps.download-artifact.outputs.filename }}