You've already forked library-registry
mirror of
https://github.com/arduino/library-registry.git
synced 2025-07-07 14:41:10 +03:00
Don't upload multiple times to same artifact in "Manage PRs" workflow
The `check-submissions` job of the "Run integration tests" GitHub Actions workflow is configured to generate multiple parallel jobs, one for each of the submitted libraries. The subsequent jobs must be able to determine whether any of the libraries failed the checks. This is done by the matrix jobs in which checks failed uploading a flag file to a GitHub Actions workflow artifact, then the subsequent jobs checking for the presence of an artifact. The "actions/upload-artifact" and "actions/download-artifact" actions are used for this purpose. Previously, a single artifact was used for all flag files, with each of the parallel jobs uploading its flag file to that single 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 parallel jobs. These artifacts can be downloaded in aggregate by using the artifact name globbing feature which was introduced in version 4.1.0 of the "actions/download-artifact" action.
This commit is contained in:
26
.github/workflows/manage-prs.yml
vendored
26
.github/workflows/manage-prs.yml
vendored
@ -5,7 +5,7 @@ env:
|
|||||||
MAINTAINERS: |
|
MAINTAINERS: |
|
||||||
# GitHub user names to request reviews from in cases where PRs can't be managed automatically.
|
# GitHub user names to request reviews from in cases where PRs can't be managed automatically.
|
||||||
- per1234
|
- per1234
|
||||||
CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT: check-submissions-failed
|
CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PREFIX: check-submissions-failed-
|
||||||
ERROR_MESSAGE_PREFIX: ":x: **ERROR:** "
|
ERROR_MESSAGE_PREFIX: ":x: **ERROR:** "
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@ -376,6 +376,13 @@ jobs:
|
|||||||
if: env.PASS == 'false'
|
if: env.PASS == 'false'
|
||||||
run: touch ${{ env.FAIL_FLAG_PATH }} # Arbitrary file to provide content for the flag artifact
|
run: touch ${{ env.FAIL_FLAG_PATH }} # Arbitrary file to provide content for the flag artifact
|
||||||
|
|
||||||
|
# Each workflow artifact must have a unique name. The job matrix doesn't provide a guaranteed unique string to use
|
||||||
|
# for a name so it is necessary to generate one.
|
||||||
|
- name: Generate unique artifact suffix
|
||||||
|
if: env.PASS == 'false'
|
||||||
|
run: |
|
||||||
|
echo "CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_SUFFIX=$(cat /proc/sys/kernel/random/uuid)" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
# The value of a job matrix output is set by whichever job happened to run last, not of use for this application.
|
# The value of a job matrix output is set by whichever job happened to run last, not of use for this application.
|
||||||
# So it's necessary to use an alternative means of indicating that at least one submission failed the checks.
|
# So it's necessary to use an alternative means of indicating that at least one submission failed the checks.
|
||||||
- name: Upload failure flag artifact
|
- name: Upload failure flag artifact
|
||||||
@ -385,7 +392,7 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
include-hidden-files: true
|
include-hidden-files: true
|
||||||
path: ${{ env.FAIL_FLAG_PATH }}
|
path: ${{ env.FAIL_FLAG_PATH }}
|
||||||
name: ${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT }}
|
name: ${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PREFIX }}${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_SUFFIX }}
|
||||||
|
|
||||||
check-submissions-result:
|
check-submissions-result:
|
||||||
needs: check-submissions
|
needs: check-submissions
|
||||||
@ -394,13 +401,22 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
pass: ${{ steps.failure-flag-exists.outcome == 'failure' }}
|
pass: ${{ steps.failure-flag-exists.outcome == 'failure' }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PATH: ${{ github.workspace }}/artifacts
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Download submission check failure flag artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PATH }}
|
||||||
|
pattern: ${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PREFIX }}*
|
||||||
|
|
||||||
- name: Check for existence of submission check failure flag artifact
|
- name: Check for existence of submission check failure flag artifact
|
||||||
id: failure-flag-exists
|
id: failure-flag-exists
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
# actions/download-artifact does not create a folder per its `path` input if no artifacts match `pattern`.
|
||||||
name: ${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT }}
|
run: |
|
||||||
|
test -d "${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PATH }}"
|
||||||
|
|
||||||
check-submissions-fail:
|
check-submissions-fail:
|
||||||
needs:
|
needs:
|
||||||
|
Reference in New Issue
Block a user