Skip to content

Commit d67cef3

Browse files
jsorefgithub-actions[bot]
authored and
github-actions[bot]
committed
Shim actions/*load-artifact
This repository uses a very small portion of the api from upload-artifact and download-artifact, all of which are available in `@v3`. As such it's possible to provide a local action that conditionally selects one of `v3` or `v4`. All instances of `upload-artifact@v3` can be switched to `@v4` when it is available. When `@v4` isn't available, `@v3` will be used. The logic for "when `@v4` is available" can be adjusted later. This shimming can also be reverted when the last version of GHES adds support for `v4`.
1 parent 2ec63d2 commit d67cef3

21 files changed

+167
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Download a Build Artifact (limited features)'
2+
description: 'Download a build artifact that was previously uploaded in the workflow by the upload-artifact action'
3+
author: 'GitHub'
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Select action
8+
id: select-action
9+
shell: bash
10+
run: |
11+
if [ "$GITHUB_SERVER_URL" == "https://github.com" ]; then
12+
echo "has-v4=1" >> "$GITHUB_OUTPUT"
13+
fi
14+
- name: Download v3
15+
id: v3
16+
if: ${{ !steps.select-action.outputs.has-v4 }}
17+
uses: ./.github/actions/download-artifact/v3
18+
- name: Download v4
19+
id: v4
20+
if: steps.select-action.outputs.has-v4
21+
uses: ./.github/actions/download-artifact/v4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: 'Download a Build Artifact v3 (limited features)'
2+
description: 'Download a build artifact that was previously uploaded in the workflow by the upload-artifact action'
3+
author: 'GitHub'
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Download v4
8+
uses: actions/download-artifact@v3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: 'Download a Build Artifact v4 (limited features)'
2+
description: 'Download a build artifact that was previously uploaded in the workflow by the upload-artifact action'
3+
author: 'GitHub'
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Download v4
8+
uses: actions/download-artifact@v4

.github/actions/prepare-test/action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ runs:
2626
mv * .github ../action/
2727
mv ../action/tests/multi-language-repo/{*,.github} .
2828
mv ../action/.github/workflows .github
29+
mkdir .github/actions
30+
mv ../action/.github/actions/*artifact .github/actions
2931
- id: get-url
3032
name: Determine URL
3133
shell: bash
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Upload a Build Artifact (limited features)'
2+
description: 'Upload a build artifact that can be used by subsequent workflow steps'
3+
author: 'GitHub'
4+
inputs:
5+
name:
6+
description: .
7+
default: 'artifact'
8+
path:
9+
description: .
10+
required: true
11+
retention-days:
12+
description: .
13+
14+
outputs:
15+
artifact-id:
16+
description: .
17+
value: ${{ steps.v4.outputs.artifact-id || steps.v3.outputs.artifact-id }}
18+
artifact-url:
19+
description: .
20+
value: ${{ steps.v4.outputs.artifact-url || steps.v3.outputs.artifact-url }}
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Select action
25+
id: select-action
26+
shell: bash
27+
run: |
28+
if [ "$GITHUB_SERVER_URL" == "https://github.com" ]; then
29+
echo "has-v4=1" >> "$GITHUB_OUTPUT"
30+
fi
31+
- name: Upload v3
32+
id: v3
33+
if: ${{ !steps.select-action.outputs.has-v4 }}
34+
uses: ./.github/actions/upload-artifact/v3
35+
with:
36+
name: ${{ inputs.name }}
37+
path: ${{ inputs.path }}
38+
description: ${{ inputs.description }}
39+
- name: Upload v4
40+
id: v4
41+
if: steps.select-action.outputs.has-v4
42+
uses: ./.github/actions/upload-artifact/v4
43+
with:
44+
name: ${{ inputs.name }}
45+
path: ${{ inputs.path }}
46+
description: ${{ inputs.description }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Upload a Build Artifact v3 (limited features)'
2+
description: 'Upload a build artifact that can be used by subsequent workflow steps'
3+
author: 'GitHub'
4+
inputs:
5+
name:
6+
description: .
7+
default: 'artifact'
8+
path:
9+
description: .
10+
required: true
11+
retention-days:
12+
description: .
13+
14+
outputs:
15+
artifact-id:
16+
description: .
17+
value: ${{ steps.upload.outputs.artifact-id }}
18+
artifact-url:
19+
description: .
20+
value: ${{ steps.upload.outputs.artifact-url }}
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Upload v3
25+
id: upload
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: ${{ inputs.name }}
29+
path: ${{ inputs.path }}
30+
description: ${{ inputs.description }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Upload a Build Artifact v4 (limited features)'
2+
description: 'Upload a build artifact that can be used by subsequent workflow steps'
3+
author: 'GitHub'
4+
inputs:
5+
name:
6+
description: .
7+
default: 'artifact'
8+
path:
9+
description: .
10+
required: true
11+
retention-days:
12+
description: .
13+
14+
outputs:
15+
artifact-id:
16+
description: .
17+
value: ${{ steps.upload.outputs.artifact-id }}
18+
artifact-url:
19+
description: .
20+
value: ${{ steps.upload.outputs.artifact-url }}
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Upload v4
25+
id: upload
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: ${{ inputs.name }}
29+
path: ${{ inputs.path }}
30+
description: ${{ inputs.description }}

.github/workflows/__config-export.yml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__diagnostics-export.yml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__export-file-baseline-information.yml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__job-run-uuid-sarif.yml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__zstd-bundle-streaming.yml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__zstd-bundle.yml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/debug-artifacts-failure.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ jobs:
6161
timeout-minutes: 45
6262
runs-on: ubuntu-latest
6363
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
6466
- name: Download all artifacts
65-
uses: actions/download-artifact@v4
67+
uses: ./.github/actions/download-artifact
6668
- name: Check expected artifacts exist
6769
shell: bash
6870
run: |

.github/workflows/debug-artifacts.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ jobs:
6767
timeout-minutes: 45
6868
runs-on: ubuntu-latest
6969
steps:
70+
- name: Checkout
71+
uses: actions/checkout@v4
7072
- name: Download all artifacts
71-
uses: actions/download-artifact@v4
73+
uses: ./.github/actions/download-artifact
7274
- name: Check expected artifacts exist
7375
shell: bash
7476
run: |

pr-checks/checks/config-export.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ steps:
1212
output: "${{ runner.temp }}/results"
1313
upload-database: false
1414
- name: Upload SARIF
15-
uses: actions/upload-artifact@v3
15+
uses: ./.github/actions/upload-artifact
1616
with:
1717
name: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
1818
path: "${{ runner.temp }}/results/javascript.sarif"

pr-checks/checks/diagnostics-export.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ steps:
2626
output: "${{ runner.temp }}/results"
2727
upload-database: false
2828
- name: Upload SARIF
29-
uses: actions/upload-artifact@v3
29+
uses: ./.github/actions/upload-artifact
3030
with:
3131
name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
3232
path: "${{ runner.temp }}/results/javascript.sarif"

pr-checks/checks/export-file-baseline-information.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ steps:
1919
with:
2020
output: "${{ runner.temp }}/results"
2121
- name: Upload SARIF
22-
uses: actions/upload-artifact@v3
22+
uses: ./.github/actions/upload-artifact
2323
with:
2424
name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json
2525
path: "${{ runner.temp }}/results/javascript.sarif"

pr-checks/checks/job-run-uuid-sarif.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ steps:
1212
with:
1313
output: "${{ runner.temp }}/results"
1414
- name: Upload SARIF
15-
uses: actions/upload-artifact@v3
15+
uses: ./.github/actions/upload-artifact
1616
with:
1717
name: ${{ matrix.os }}-${{ matrix.version }}.sarif.json
1818
path: "${{ runner.temp }}/results/javascript.sarif"

pr-checks/checks/zstd-bundle-streaming.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ steps:
2929
output: ${{ runner.temp }}/results
3030
upload-database: false
3131
- name: Upload SARIF
32-
uses: actions/upload-artifact@v3
32+
uses: ./.github/actions/upload-artifact
3333
with:
34-
name: zstd-bundle.sarif
34+
name: ${{ matrix.os }}-zstd-bundle.sarif
3535
path: ${{ runner.temp }}/results/javascript.sarif
3636
retention-days: 7
3737
- name: Check diagnostic with expected tools URL appears in SARIF

pr-checks/checks/zstd-bundle.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ steps:
2929
output: ${{ runner.temp }}/results
3030
upload-database: false
3131
- name: Upload SARIF
32-
uses: actions/upload-artifact@v3
32+
uses: ./.github/actions/upload-artifact
3333
with:
34-
name: zstd-bundle.sarif
34+
name: ${{ matrix.os }}-zstd-bundle.sarif
3535
path: ${{ runner.temp }}/results/javascript.sarif
3636
retention-days: 7
3737
- name: Check diagnostic with expected tools URL appears in SARIF

0 commit comments

Comments
 (0)