Skip to content

Commit 6ed1603

Browse files
committed
pin actions to sha, use secrets.GITHUB_TOKEN
1 parent a78a7ea commit 6ed1603

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

.github/workflows/04-advanced-features--03-caching.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
working-directory: 04-advanced-features/caching/minimal-node-project
5353

5454
steps:
55-
- uses: actions/checkout@v4
55+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5656
- uses: actions/setup-node@v4
5757
with:
5858
node-version: 20

.github/workflows/04-advanced-features--04-github-permissions.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
pull-requests: read # Can read PR data only
4141
continue-on-error: true # Avoids failing entire workflow
4242
steps:
43-
- uses: actions/checkout@v4
43+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4444

4545
- name: Install GitHub CLI
4646
run: |
@@ -50,11 +50,11 @@ jobs:
5050
- name: List the first 5 open PRs (allowed)
5151
run: gh pr list --limit 5
5252
env:
53-
GH_TOKEN: ${{ github.token }}
53+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5454

5555
- name: Attempt to add a label (expected to fail)
5656
env:
57-
GH_TOKEN: ${{ github.token }}
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858
run: |
5959
gh pr edit 1 --add-label "documentation"
6060
@@ -67,7 +67,7 @@ jobs:
6767
permissions:
6868
pull-requests: write
6969
steps:
70-
- uses: actions/checkout@v4
70+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7171

7272
- name: Install GitHub CLI
7373
run: |
@@ -76,10 +76,9 @@ jobs:
7676
7777
- name: Attempt to add a label (expected to succeed)
7878
env:
79-
GH_TOKEN: ${{ github.token }}
79+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8080
run: |
8181
gh pr edit 1 --add-label "documentation"
82-
- name: Confirm the
83-
82+
- name: Confirm the
8483
if: success()
85-
run: echo "✅ Write operation succeeded!"
84+
run: echo "✅ Write operation succeeded!"

.github/workflows/06-authoring-actions--01-composite-action.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Composite Action Demo
2-
32
on:
43
workflow_dispatch:
54

@@ -8,7 +7,7 @@ jobs:
87
runs-on: ubuntu-24.04
98
name: One usage of the composite action
109
steps:
11-
- uses: actions/checkout@v4
10+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1211
- id: composite-action-instance
1312
uses: ./06-authoring-actions/composite-action
1413
with:
@@ -17,12 +16,11 @@ jobs:
1716
RANDOM_NUMBER: ${{ steps.composite-action-instance.outputs.random-number }}
1817
run: echo random-number "$RANDOM_NUMBER"
1918
shell: bash
20-
2119
hello-world-2:
2220
runs-on: ubuntu-24.04
2321
name: Another usage of the composite action
2422
steps:
25-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2624
- id: composite-action-instance
2725
uses: ./06-authoring-actions/composite-action
2826
with:

0 commit comments

Comments
 (0)