Skip to content

Commit d67cef3

Browse files
jsorefgithub-actions[bot]
authored andcommitted
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
Lines changed: 21 additions & 0 deletions
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
Lines changed: 8 additions & 0 deletions
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
Lines changed: 8 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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
Lines changed: 46 additions & 0 deletions
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 }}
Lines changed: 30 additions & 0 deletions
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 }}
Lines changed: 30 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__diagnostics-export.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)