Skip to content

Commit eeea659

Browse files
authored
[skip changelog] Sync "Check Go Dependencies" workflow with upstream (#1723)
A "Check Go Dependencies" GitHub Actions workflow is used to check whether all Go package dependencies of the modules in this repository use compatible licenses. This workflow is hosted and maintained in a repository dedicated to a collection of such reusable Arduino tooling project assets. Several enhancements have been made to the upstream file, which are pulled into the Arduino CLI repository here: - Add schedule event trigger to catch breakage caused by external changes arduino/tooling-project-assets@e71e470 - Run workflow on release branch creation arduino/tooling-project-assets@22504dc
1 parent cb99229 commit eeea659

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

.github/workflows/check-go-dependencies-task.yml

+33-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
name: Check Go Dependencies
33

44
env:
5-
# See: https://github.com/actions/setup-go/tree/v2#readme
5+
# See: https://github.com/actions/setup-go/tree/v3#readme
66
GO_VERSION: "1.17"
77

8-
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
99
on:
10+
create:
1011
push:
1112
paths:
1213
- ".github/workflows/check-go-dependencies-task.ya?ml"
@@ -27,11 +28,39 @@ on:
2728
- "**/.gitmodules"
2829
- "**/go.mod"
2930
- "**/go.sum"
31+
schedule:
32+
# Run periodically to catch breakage caused by external changes.
33+
- cron: "0 8 * * WED"
3034
workflow_dispatch:
3135
repository_dispatch:
3236

3337
jobs:
38+
run-determination:
39+
runs-on: ubuntu-latest
40+
outputs:
41+
result: ${{ steps.determination.outputs.result }}
42+
steps:
43+
- name: Determine if the rest of the workflow should run
44+
id: determination
45+
run: |
46+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
47+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
48+
if [[
49+
"${{ github.event_name }}" != "create" ||
50+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
51+
]]; then
52+
# Run the other jobs.
53+
RESULT="true"
54+
else
55+
# There is no need to run the other jobs.
56+
RESULT="false"
57+
fi
58+
59+
echo "::set-output name=result::$RESULT"
60+
3461
check-cache:
62+
needs: run-determination
63+
if: needs.run-determination.outputs.result == 'true'
3564
runs-on: ubuntu-latest
3665

3766
steps:
@@ -80,6 +109,8 @@ jobs:
80109
path: .licenses/
81110

82111
check-deps:
112+
needs: run-determination
113+
if: needs.run-determination.outputs.result == 'true'
83114
runs-on: ubuntu-latest
84115

85116
steps:

0 commit comments

Comments
 (0)