Skip to content

Commit 6f89aae

Browse files
authored
Merge pull request #5 from github/workflow-maintenance
Use explicit immutable Actions, move permissions to top of workflow, add missing test file, add test workflow
2 parents 049a603 + c9f903a commit 6f89aae

File tree

5 files changed

+43
-9
lines changed

5 files changed

+43
-9
lines changed

.github/workflows/eslint.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ on:
1818
schedule:
1919
- cron: '18 22 * * 0'
2020

21+
permissions:
22+
contents: read
23+
2124
jobs:
2225
eslint:
2326
name: Run eslint scanning
2427
runs-on: ubuntu-latest
2528
permissions:
26-
contents: read
2729
security-events: write
2830
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
2931
steps:
3032
- name: Checkout code
31-
uses: actions/checkout@v3
33+
uses: actions/checkout@4.2.2
3234

3335
- name: Install ESLint
3436
run: |
@@ -46,7 +48,7 @@ jobs:
4648
continue-on-error: true
4749

4850
- name: Upload analysis results to GitHub
49-
uses: github/codeql-action/upload-sarif@v3
51+
uses: github/codeql-action/upload-sarif@3.28.15
5052
with:
5153
sarif_file: eslint-results.sarif
5254
wait-for-processing: true

.github/workflows/publish.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ on:
66

77
permissions:
88
contents: read
9-
id-token: write
109

1110
jobs:
1211
publish-npm:
1312
runs-on: ubuntu-latest
13+
permissions:
14+
id-token: write
1415
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
16+
- name: Checkout code
17+
uses: actions/[email protected]
18+
- name: Setup Node
19+
uses: actions/[email protected]
1720
with:
1821
node-version: 22
1922
registry-url: https://registry.npmjs.org/

.github/workflows/scorecard.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- name: "Checkout code"
32-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
uses: actions/checkout@4.2.2
3333
with:
3434
persist-credentials: false
3535

@@ -49,7 +49,7 @@ jobs:
4949
# uploads of run results in SARIF format to the repository Actions tab.
5050
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
5151
- name: "Upload artifact"
52-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
52+
uses: actions/upload-artifact@4.6.2
5353
with:
5454
name: SARIF file
5555
path: results.sarif
@@ -58,6 +58,6 @@ jobs:
5858
# Upload the results to GitHub's code scanning dashboard (optional).
5959
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
6060
- name: "Upload to code-scanning"
61-
uses: github/codeql-action/upload-sarif@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12
61+
uses: github/codeql-action/upload-sarif@3.28.12
6262
with:
6363
sarif_file: results.sarif

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test with npm
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "main" ]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/[email protected]
19+
- name: Setup Node
20+
uses: actions/[email protected]
21+
with:
22+
node-version: 22
23+
registry-url: https://registry.npmjs.org/
24+
cache: npm
25+
- run: npm ci
26+
- run: npm test

testFile.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"owner1/repo1/path/to/action": ["sha1", "sha2"]
3+
}

0 commit comments

Comments
 (0)