Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump actions/upload-artifact from 3 to 4 #3750

Merged
merged 5 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions .github/workflows/manage-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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:
Expand Down Expand Up @@ -103,7 +103,7 @@
--output "${{ steps.configuration.outputs.path }}/{}" \
--header "Authorization: token $GITHUB_TOKEN" \
--header "Accept: application/vnd.github.v3.{}" \
https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ github.event.pull_request.number }}${{ github.event.issue.number }}

Check warning on line 106 in .github/workflows/manage-prs.yml

View workflow job for this annotation

GitHub Actions / Generate problem matcher output

106:121 [line-length] line too long (189 > 120 characters)

Check warning on line 106 in .github/workflows/manage-prs.yml

View workflow job for this annotation

GitHub Actions / Generate problem matcher output

106:121 [line-length] line too long (189 > 120 characters)
' \
::: \
${{ env.DIFF_IDENTIFIER }} \
Expand All @@ -114,7 +114,7 @@
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 }}
Expand Down Expand Up @@ -144,13 +144,13 @@
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 }}

Expand Down Expand Up @@ -376,16 +376,23 @@
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
Expand All @@ -394,13 +401,22 @@
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:
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

env:
CONFIGURATIONS_FOLDER: .github/label-configuration-files
CONFIGURATIONS_ARTIFACT: label-configuration-files
CONFIGURATIONS_ARTIFACT_PREFIX: label-configuration-file-

jobs:
check:
Expand Down Expand Up @@ -67,16 +67,16 @@
- name: Download
uses: carlosperate/download-file-action@v2
with:
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }}

Check warning on line 70 in .github/workflows/sync-labels.yml

View workflow job for this annotation

GitHub Actions / Generate problem matcher output

70:121 [line-length] line too long (150 > 120 characters)

Check warning on line 70 in .github/workflows/sync-labels.yml

View workflow job for this annotation

GitHub Actions / Generate problem matcher output

70:121 [line-length] line too long (150 > 120 characters)

- 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
Expand All @@ -85,7 +85,7 @@
steps:
- name: Set environment variables
run: |
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable

Check warning on line 88 in .github/workflows/sync-labels.yml

View workflow job for this annotation

GitHub Actions / Generate problem matcher output

88:121 [line-length] line too long (130 > 120 characters)

Check warning on line 88 in .github/workflows/sync-labels.yml

View workflow job for this annotation

GitHub Actions / Generate problem matcher output

88:121 [line-length] line too long (130 > 120 characters)
echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV"

- name: Determine whether to dry run
Expand All @@ -107,16 +107,17 @@
- 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: |
Expand Down
Loading