Skip to content

Commit abab3f2

Browse files
authored
Merge pull request #291 from per1234/update-infra
Sync infrastructure assets from upstream "templates"
2 parents 9cbdcb8 + bc8c3bd commit abab3f2

16 files changed

+142
-69
lines changed

.github/workflows/check-action-metadata-task.yml

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ on:
3131
jobs:
3232
run-determination:
3333
runs-on: ubuntu-latest
34+
permissions: {}
3435
outputs:
3536
result: ${{ steps.determination.outputs.result }}
3637
steps:
@@ -56,6 +57,8 @@ jobs:
5657
needs: run-determination
5758
if: needs.run-determination.outputs.result == 'true'
5859
runs-on: ubuntu-latest
60+
permissions:
61+
contents: read
5962

6063
steps:
6164
- name: Checkout repository

.github/workflows/check-files-task.yml

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
jobs:
1616
run-determination:
1717
runs-on: ubuntu-latest
18+
permissions: {}
1819
outputs:
1920
result: ${{ steps.determination.outputs.result }}
2021
steps:
@@ -40,6 +41,8 @@ jobs:
4041
needs: run-determination
4142
if: needs.run-determination.outputs.result == 'true'
4243
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read
4346

4447
steps:
4548
- name: Checkout repository
@@ -58,6 +61,8 @@ jobs:
5861
needs: run-determination
5962
if: needs.run-determination.outputs.result == 'true'
6063
runs-on: ubuntu-latest
64+
permissions:
65+
contents: read
6166

6267
steps:
6368
- name: Checkout repository

.github/workflows/check-general-formatting-task.yml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
jobs:
1616
run-determination:
1717
runs-on: ubuntu-latest
18+
permissions: {}
1819
outputs:
1920
result: ${{ steps.determination.outputs.result }}
2021
steps:
@@ -40,6 +41,8 @@ jobs:
4041
needs: run-determination
4142
if: needs.run-determination.outputs.result == 'true'
4243
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read
4346

4447
steps:
4548
- name: Set environment variables

.github/workflows/check-license.yml

+23-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-license.md
22
name: Check License
33

4-
env:
5-
EXPECTED_LICENSE_FILENAME: LICENSE.txt
6-
# SPDX identifier: https://spdx.org/licenses/
7-
EXPECTED_LICENSE_TYPE: GPL-3.0
8-
94
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
105
on:
116
create:
@@ -35,6 +30,7 @@ on:
3530
jobs:
3631
run-determination:
3732
runs-on: ubuntu-latest
33+
permissions: {}
3834
outputs:
3935
result: ${{ steps.determination.outputs.result }}
4036
steps:
@@ -57,9 +53,22 @@ jobs:
5753
echo "result=$RESULT" >> $GITHUB_OUTPUT
5854
5955
check-license:
56+
name: ${{ matrix.check-license.path }}
6057
needs: run-determination
6158
if: needs.run-determination.outputs.result == 'true'
6259
runs-on: ubuntu-latest
60+
permissions:
61+
contents: read
62+
63+
strategy:
64+
fail-fast: false
65+
66+
matrix:
67+
check-license:
68+
- path: ./
69+
expected-filename: LICENSE.txt
70+
# SPDX identifier: https://spdx.org/licenses/
71+
expected-type: GPL-3.0
6372

6473
steps:
6574
- name: Checkout repository
@@ -73,23 +82,27 @@ jobs:
7382
- name: Install licensee
7483
run: gem install licensee
7584

76-
- name: Check license file
85+
- name: Check license file for ${{ matrix.check-license.path }}
7786
run: |
7887
EXIT_STATUS=0
88+
89+
# Go into folder path
90+
cd ./${{ matrix.check-license.path }}
91+
7992
# See: https://github.com/licensee/licensee
8093
LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)"
8194
8295
DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')"
8396
echo "Detected license file: $DETECTED_LICENSE_FILE"
84-
if [ "$DETECTED_LICENSE_FILE" != "\"${EXPECTED_LICENSE_FILENAME}\"" ]; then
85-
echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: $EXPECTED_LICENSE_FILENAME"
97+
if [ "$DETECTED_LICENSE_FILE" != "\"${{ matrix.check-license.expected-filename }}\"" ]; then
98+
echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: ${{ matrix.check-license.expected-filename }}"
8699
EXIT_STATUS=1
87100
fi
88101
89102
DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')"
90103
echo "Detected license type: $DETECTED_LICENSE_TYPE"
91-
if [ "$DETECTED_LICENSE_TYPE" != "\"${EXPECTED_LICENSE_TYPE}\"" ]; then
92-
echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${EXPECTED_LICENSE_TYPE}\""
104+
if [ "$DETECTED_LICENSE_TYPE" != "\"${{ matrix.check-license.expected-type }}\"" ]; then
105+
echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${{ matrix.check-license.expected-type }}\""
93106
EXIT_STATUS=1
94107
fi
95108

.github/workflows/check-markdown-task.yml

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ on:
4141
jobs:
4242
run-determination:
4343
runs-on: ubuntu-latest
44+
permissions: {}
4445
outputs:
4546
result: ${{ steps.determination.outputs.result }}
4647
steps:
@@ -66,6 +67,8 @@ jobs:
6667
needs: run-determination
6768
if: needs.run-determination.outputs.result == 'true'
6869
runs-on: ubuntu-latest
70+
permissions:
71+
contents: read
6972

7073
steps:
7174
- name: Checkout repository
@@ -92,6 +95,8 @@ jobs:
9295
needs: run-determination
9396
if: needs.run-determination.outputs.result == 'true'
9497
runs-on: ubuntu-latest
98+
permissions:
99+
contents: read
95100

96101
steps:
97102
- name: Checkout repository

.github/workflows/check-npm-task.yml

+22-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ on:
2626
workflow_dispatch:
2727
repository_dispatch:
2828

29-
permissions:
30-
contents: read
31-
3229
jobs:
3330
run-determination:
3431
runs-on: ubuntu-latest
32+
permissions: {}
3533
outputs:
3634
result: ${{ steps.determination.outputs.result }}
3735
steps:
@@ -54,9 +52,18 @@ jobs:
5452
echo "result=$RESULT" >> $GITHUB_OUTPUT
5553
5654
validate:
55+
name: validate (${{ matrix.project.path }})
5756
needs: run-determination
5857
if: needs.run-determination.outputs.result == 'true'
5958
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
project:
66+
- path: .
6067

6168
steps:
6269
- name: Checkout repository
@@ -74,12 +81,21 @@ jobs:
7481
version: 3.x
7582

7683
- name: Validate package.json
77-
run: task --silent npm:validate
84+
run: task --silent npm:validate PROJECT_PATH="${{ matrix.project.path }}"
7885

7986
check-sync:
87+
name: check-sync (${{ matrix.project.path }})
8088
needs: run-determination
8189
if: needs.run-determination.outputs.result == 'true'
8290
runs-on: ubuntu-latest
91+
permissions:
92+
contents: read
93+
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
project:
98+
- path: .
8399

84100
steps:
85101
- name: Checkout repository
@@ -97,7 +113,7 @@ jobs:
97113
version: 3.x
98114

99115
- name: Install npm dependencies
100-
run: task npm:install-deps
116+
run: task npm:install-deps PROJECT_PATH="${{ matrix.project.path }}"
101117

102118
- name: Check package-lock.json
103-
run: git diff --color --exit-code package-lock.json
119+
run: git diff --color --exit-code "${{ matrix.project.path }}/package-lock.json"

.github/workflows/check-prettier-formatting-task.yml

+3
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ on:
209209
jobs:
210210
run-determination:
211211
runs-on: ubuntu-latest
212+
permissions: {}
212213
outputs:
213214
result: ${{ steps.determination.outputs.result }}
214215
steps:
@@ -234,6 +235,8 @@ jobs:
234235
needs: run-determination
235236
if: needs.run-determination.outputs.result == 'true'
236237
runs-on: ubuntu-latest
238+
permissions:
239+
contents: read
237240

238241
steps:
239242
- name: Checkout repository

.github/workflows/check-python-task.yml

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ on:
3535
jobs:
3636
run-determination:
3737
runs-on: ubuntu-latest
38+
permissions: {}
3839
outputs:
3940
result: ${{ steps.determination.outputs.result }}
4041
steps:
@@ -60,6 +61,8 @@ jobs:
6061
needs: run-determination
6162
if: needs.run-determination.outputs.result == 'true'
6263
runs-on: ubuntu-latest
64+
permissions:
65+
contents: read
6366

6467
steps:
6568
- name: Checkout repository
@@ -92,6 +95,8 @@ jobs:
9295
needs: run-determination
9396
if: needs.run-determination.outputs.result == 'true'
9497
runs-on: ubuntu-latest
98+
permissions:
99+
contents: read
95100

96101
steps:
97102
- name: Checkout repository

.github/workflows/check-taskfiles.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ on:
2929
jobs:
3030
run-determination:
3131
runs-on: ubuntu-latest
32+
permissions: {}
3233
outputs:
3334
result: ${{ steps.determination.outputs.result }}
3435
steps:
@@ -55,6 +56,8 @@ jobs:
5556
needs: run-determination
5657
if: needs.run-determination.outputs.result == 'true'
5758
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
5861

5962
strategy:
6063
fail-fast: false

.github/workflows/check-toc-task.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ on:
2929
jobs:
3030
run-determination:
3131
runs-on: ubuntu-latest
32+
permissions: {}
3233
outputs:
3334
result: ${{ steps.determination.outputs.result }}
3435
steps:
@@ -55,6 +56,8 @@ jobs:
5556
needs: run-determination
5657
if: needs.run-determination.outputs.result == 'true'
5758
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
5861

5962
strategy:
6063
fail-fast: false

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

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ on:
2828
jobs:
2929
validate:
3030
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
3133

3234
steps:
3335
- name: Checkout repository

.github/workflows/check-yaml-task.yml

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ on:
4747
jobs:
4848
run-determination:
4949
runs-on: ubuntu-latest
50+
permissions: {}
5051
outputs:
5152
result: ${{ steps.determination.outputs.result }}
5253
steps:
@@ -73,6 +74,8 @@ jobs:
7374
needs: run-determination
7475
if: needs.run-determination.outputs.result == 'true'
7576
runs-on: ubuntu-latest
77+
permissions:
78+
contents: read
7679

7780
strategy:
7881
fail-fast: false

.github/workflows/spell-check-task.yml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
jobs:
1616
run-determination:
1717
runs-on: ubuntu-latest
18+
permissions: {}
1819
outputs:
1920
result: ${{ steps.determination.outputs.result }}
2021
steps:
@@ -40,6 +41,8 @@ jobs:
4041
needs: run-determination
4142
if: needs.run-determination.outputs.result == 'true'
4243
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read
4346

4447
steps:
4548
- name: Checkout repository

.github/workflows/sync-labels-npm.yml

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ on:
3030
jobs:
3131
check:
3232
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
3335

3436
steps:
3537
- name: Checkout repository
@@ -65,6 +67,7 @@ jobs:
6567
download:
6668
needs: check
6769
runs-on: ubuntu-latest
70+
permissions: {}
6871

6972
strategy:
7073
matrix:
@@ -92,6 +95,9 @@ jobs:
9295
sync:
9396
needs: download
9497
runs-on: ubuntu-latest
98+
permissions:
99+
contents: read
100+
issues: write
95101

96102
steps:
97103
- name: Set environment variables

.github/workflows/test-python-poetry-task.yml

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
outputs:
4343
result: ${{ steps.determination.outputs.result }}
44+
permissions: {}
4445
steps:
4546
- name: Determine if the rest of the workflow should run
4647
id: determination
@@ -64,6 +65,8 @@ jobs:
6465
needs: run-determination
6566
if: needs.run-determination.outputs.result == 'true'
6667
runs-on: ubuntu-latest
68+
permissions:
69+
contents: read
6770

6871
steps:
6972
- name: Checkout repository

0 commit comments

Comments
 (0)