diff --git a/.github/workflows/manage-prs.yml b/.github/workflows/manage-prs.yml index 06b4b5959..9282bb924 100644 --- a/.github/workflows/manage-prs.yml +++ b/.github/workflows/manage-prs.yml @@ -5,7 +5,7 @@ env: MAINTAINERS: | # GitHub user names to request reviews from in cases where PRs can't be managed automatically. - per1234 - CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT: check-submissions-failed + CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PREFIX: check-submissions-failed- ERROR_MESSAGE_PREFIX: ":x: **ERROR:** " on: @@ -114,7 +114,7 @@ jobs: run: echo "::set-output name=head::$(jq -c .head.sha "${{ steps.configuration.outputs.path }}/${{ env.JSON_IDENTIFIER }}")" - name: Upload diff file to workflow artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: ${{ steps.configuration.outputs.path }}/${{ steps.configuration.outputs.filename }} name: ${{ steps.configuration.outputs.artifact }} @@ -144,13 +144,13 @@ jobs: location: ${{ runner.temp }} - name: Download diff - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: ${{ needs.diff.outputs.path }} name: ${{ needs.diff.outputs.artifact }} - name: Remove no longer needed artifact - uses: geekyeggo/delete-artifact@v2 + uses: geekyeggo/delete-artifact@v5 with: name: ${{ needs.diff.outputs.artifact }} @@ -376,16 +376,23 @@ jobs: if: env.PASS == 'false' 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. # So it's necessary to use an alternative means of indicating that at least one submission failed the checks. - name: Upload failure flag artifact if: env.PASS == 'false' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error include-hidden-files: true 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: needs: check-submissions @@ -394,13 +401,22 @@ jobs: outputs: pass: ${{ steps.failure-flag-exists.outcome == 'failure' }} + env: + CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PATH: ${{ github.workspace }}/artifacts + 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 id: failure-flag-exists - uses: actions/download-artifact@v3 continue-on-error: true - with: - name: ${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT }} + # actions/download-artifact does not create a folder per its `path` input if no artifacts match `pattern`. + run: | + test -d "${{ env.CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT_PATH }}" check-submissions-fail: needs: diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 9cde1acc6..514f29a7d 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -19,7 +19,7 @@ on: env: CONFIGURATIONS_FOLDER: .github/label-configuration-files - CONFIGURATIONS_ARTIFACT: label-configuration-files + CONFIGURATIONS_ARTIFACT_PREFIX: label-configuration-file- jobs: check: @@ -70,13 +70,13 @@ jobs: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} - name: Pass configuration files to next job via workflow artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: | *.yaml *.yml if-no-files-found: error - name: ${{ env.CONFIGURATIONS_ARTIFACT }} + name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}${{ matrix.filename }} sync: needs: download @@ -107,16 +107,17 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Download configuration files artifact - uses: actions/download-artifact@v3 + - name: Download configuration file artifacts + uses: actions/download-artifact@v4 with: - name: ${{ env.CONFIGURATIONS_ARTIFACT }} + merge-multiple: true + pattern: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}* path: ${{ env.CONFIGURATIONS_FOLDER }} - - name: Remove unneeded artifact - uses: geekyeggo/delete-artifact@v2 + - name: Remove unneeded artifacts + uses: geekyeggo/delete-artifact@v5 with: - name: ${{ env.CONFIGURATIONS_ARTIFACT }} + name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}* - name: Merge label configuration files run: |