Skip to content

Commit 17cead1

Browse files
committed
Don't upload multiple times to same artifact in label sync workflow
The "Sync Labels" GitHub Actions workflow is configured to allow the use of multiple shared label configuration files. This is done by using a job matrix in the GitHub Actions workflow to download each of the files from the source repository in a parallel GitHub Actions workflow job. A GitHub Actions workflow artifact was used to transfer the generated files between sequential jobs in the workflow. The "actions/upload-artifact" and "actions/download-artifact" actions are used for this purpose. Previously, a single artifact was used for the transfer of all the shared label configuration files, with each of the parallel jobs uploading its own generated files to that artifact. However, support for uploading multiple times to a single artifact was dropped in version 4.0.0 of the "actions/upload-artifact" action. So it is now necessary to use a dedicated artifact for each of the builds. These can be downloaded in aggregate by using the artifact name globbing and merging features which were introduced in version 4.1.0 of the "actions/download-artifact" action.
1 parent e90eb49 commit 17cead1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/sync-labels-npm.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
# See: https://github.com/actions/setup-node/#readme
66
NODE_VERSION: 16.x
77
CONFIGURATIONS_FOLDER: .github/label-configuration-files
8-
CONFIGURATIONS_ARTIFACT: label-configuration-files
8+
CONFIGURATIONS_ARTIFACT_PREFIX: label-configuration-file-
99

1010
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
1111
on:
@@ -86,7 +86,7 @@ jobs:
8686
*.yaml
8787
*.yml
8888
if-no-files-found: error
89-
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
89+
name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}${{ matrix.filename }}
9090

9191
sync:
9292
needs: download
@@ -117,16 +117,17 @@ jobs:
117117
- name: Checkout repository
118118
uses: actions/checkout@v4
119119

120-
- name: Download configuration files artifact
120+
- name: Download configuration file artifacts
121121
uses: actions/download-artifact@v4
122122
with:
123-
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
123+
merge-multiple: true
124+
pattern: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}*
124125
path: ${{ env.CONFIGURATIONS_FOLDER }}
125126

126-
- name: Remove unneeded artifact
127+
- name: Remove unneeded artifacts
127128
uses: geekyeggo/delete-artifact@v5
128129
with:
129-
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
130+
name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}*
130131

131132
- name: Setup Node.js
132133
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)