Skip to content

Commit

Permalink
Merge pull request #51 from arduino/update-sync-labels
Browse files Browse the repository at this point in the history
Updated some github-actions workflows
  • Loading branch information
cmaglie authored Sep 18, 2024
2 parents fbec7bc + a2d9450 commit e433b58
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/check-go-dependencies-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -56,19 +57,27 @@ jobs:
RESULT="false"
fi
echo "::set-output name=result::$RESULT"
echo "result=$RESULT" >> $GITHUB_OUTPUT
check-cache:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

# This is required to allow jonabc/setup-licensed to install licensed via Ruby gem.
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby # Install latest version

- name: Install licensed
uses: jonabc/setup-licensed@v1
with:
Expand Down Expand Up @@ -102,7 +111,7 @@ jobs:
# Some might find it convenient to have CI generate the cache rather than setting up for it locally
- name: Upload cache to workflow artifact
if: failure() && steps.diff.outcome == 'failure'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
include-hidden-files: true
Expand All @@ -113,13 +122,21 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

# This is required to allow jonabc/setup-licensed to install licensed via Ruby gem.
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby # Install latest version

- name: Install licensed
uses: jonabc/setup-licensed@v1
with:
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md
name: Sync Labels

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
on:
push:
paths:
Expand All @@ -24,6 +24,8 @@ env:
jobs:
check:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down Expand Up @@ -55,6 +57,7 @@ jobs:
download:
needs: check
runs-on: ubuntu-latest
permissions: {}

strategy:
matrix:
Expand All @@ -71,22 +74,25 @@ 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 }}-${{ matrix.filename }}

sync:
needs: download
runs-on: ubuntu-latest
permissions:
contents: read
issues: write

steps:
- name: Set environment variables
run: |
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV"
- name: Determine whether to dry run
Expand All @@ -103,21 +109,22 @@ jobs:
run: |
# Use of this flag in the github-label-sync command will cause it to only check the validity of the
# configuration.
echo "::set-output name=flag::--dry-run"
echo "flag=--dry-run" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v4

- name: Download configuration files artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
pattern: ${{ env.CONFIGURATIONS_ARTIFACT }}-*
merge-multiple: true
path: ${{ env.CONFIGURATIONS_FOLDER }}

- name: Remove unneeded artifact
uses: geekyeggo/delete-artifact@v2
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
name: ${{ env.CONFIGURATIONS_ARTIFACT }}-*

- name: Merge label configuration files
run: |
Expand Down

0 comments on commit e433b58

Please sign in to comment.