Skip to content

Commit 918900f

Browse files
zimegmwbrooks
andauthored
ci: pin action hashes and escape variables with minimum permission (#100)
Co-authored-by: Michael Brooks <[email protected]>
1 parent 7235111 commit 918900f

File tree

6 files changed

+32
-35
lines changed

6 files changed

+32
-35
lines changed

.github/workflows/delete-pr-build-on-close.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name: Delete pre-release when a branch is deleted
1313
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-pull_request-workflow-when-a-pull-request-merges
1414
# See https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target
1515
on:
16-
pull_request_target:
16+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1717
types:
1818
- closed
1919

.github/workflows/dependencies.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@ jobs:
1212
steps:
1313
- name: Gather credentials
1414
id: credentials
15-
uses: actions/[email protected]
15+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
1616
with:
1717
app-id: ${{ secrets.GH_APP_ID_RELEASER }}
1818
private-key: ${{ secrets.GH_APP_PRIVATE_KEY_RELEASER }}
1919
- name: Checkout the repo
20-
uses: actions/[email protected]
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2121
with:
22+
persist-credentials: true
2223
ref: main
2324
token: ${{ steps.credentials.outputs.token }}
2425
- name: Install Golang
25-
uses: actions/[email protected]
26+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
2627
with:
2728
go-version: "stable"
2829
- name: Get the latest version

.github/workflows/e2e_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ jobs:
2222
steps:
2323
- name: Trigger CircleCI 'local' workflow
2424
if: ${{ github.event.inputs.status == 'false' }}
25-
uses: promiseofcake/[email protected]
25+
uses: promiseofcake/circleci-trigger-action@31bce5a96436643ef4aa09acc954916d7316bb1b # v1.7.8
2626
with:
2727
user-token: ${{ secrets.CIRCLECI_TOKEN }}
2828
project-slug: slackapi/slack-cli
2929
branch: ${{ github.event.inputs.branch }}
3030
payload: '{"run_local_build_test_workflow": true}'
3131
- name: Trigger CircleCI 'e2e' workflow
3232
if: ${{ github.event.inputs.status == 'true' }}
33-
uses: promiseofcake/[email protected]
33+
uses: promiseofcake/circleci-trigger-action@31bce5a96436643ef4aa09acc954916d7316bb1b # v1.7.8
3434
with:
3535
user-token: ${{ secrets.CIRCLECI_TOKEN }}
3636
project-slug: slackapi/slack-cli

.github/workflows/license_check.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@ jobs:
1313
permissions:
1414
contents: read
1515
steps:
16-
- uses: actions/[email protected]
16+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1717
with:
18-
# Number of commits to fetch. 0 indicates all history for all branches and tags.
19-
# Default: 1
20-
# TODO - We should not fetch all history.
21-
# But we need to fetch the latest tag to run `make test` and `make build`.
22-
# This is a workaround until we fetch the latest tag using the Makefile.
23-
fetch-depth: 0
18+
persist-credentials: false
2419
- name: Check license headers
25-
uses: apache/[email protected]
20+
uses: apache/skywalking-eyes@5c5b974209f0de5d905f37deb69369068ebfc15c # v0.7.0
2621
with:
2722
config: .licenserc.yml

.github/workflows/sync-docs-from-cli-repo.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ jobs:
2222
steps:
2323
- name: Generate a GitHub token
2424
id: ghtoken
25-
uses: actions/[email protected]
25+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
2626
with:
2727
app-id: ${{ secrets.GH_APP_ID_DOCS }}
2828
owner: slackapi
2929
private-key: ${{ secrets.GH_APP_PRIVATE_KEY_DOCS }}
3030

3131
- name: Checkout the tool repo (source)
32-
uses: actions/[email protected]
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
with:
34+
persist-credentials: false
3335

3436
- name: Checkout the docs site repo (destination)
35-
uses: actions/[email protected]
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3638
with:
3739
repository: slackapi/slackapi.github.io
3840
path: "docs_repo"
@@ -41,7 +43,9 @@ jobs:
4143

4244
- name: Update docs in docs site repo
4345
run: |
44-
rsync -av --delete ./docs/ ./docs_repo/content/${{ github.event.repository.name }}/
46+
rsync -av --delete ./docs/ "./docs_repo/content/$REPO/"
47+
env:
48+
REPO: ${{ github.event.repository.name }}
4549

4650
- name: Install dependencies
4751
run: |
@@ -56,7 +60,7 @@ jobs:
5660
- name: Create a pull request
5761
if: ${{ github.ref_name == github.event.repository.default_branch || github.event_name == 'workflow_dispatch' }}
5862
id: site-pr
59-
uses: peter-evans/[email protected]
63+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
6064
with:
6165
token: ${{ steps.ghtoken.outputs.token }}
6266
title: "From ${{ github.event.repository.name }}: ${{ github.event.pull_request.title || 'manual docs sync' }}"
@@ -72,4 +76,6 @@ jobs:
7276
- name: Output the pull request link
7377
if: ${{ steps.site-pr.outputs.pull-request-url }}
7478
run: |
75-
echo "Pull request created: ${{ steps.site-pr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY
79+
echo "Pull request created: $URL" >> $GITHUB_STEP_SUMMARY
80+
env:
81+
URL: ${{ steps.site-pr.outputs.pull-request-url }}

.github/workflows/tests.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,23 @@ jobs:
1818
permissions:
1919
contents: read
2020
steps:
21-
- uses: actions/[email protected]
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2222
with:
23-
# Number of commits to fetch. 0 indicates all history for all branches and tags.
24-
# Default: 1
25-
# TODO - We should not fetch all history.
26-
# But we need to fetch the latest tag to run `make test` and `make build`.
27-
# This is a workaround until we fetch the latest tag using the Makefile.
2823
fetch-depth: 0
29-
24+
persist-credentials: false
3025
- name: Set up Go
31-
uses: actions/[email protected]
26+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
3227
with:
3328
go-version: "1.24.3"
3429
- name: Lint
35-
uses: golangci/[email protected]
30+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
3631
with:
3732
version: latest
3833
args: --timeout=5m
39-
4034
- name: Unit Tests
4135
run: make test
42-
4336
- name: Upload coverage to Codecov
44-
uses: codecov/[email protected]
37+
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
4538
with:
4639
token: ${{ secrets.CODECOV_TOKEN }}
4740
files: ./coverage.out
@@ -55,13 +48,15 @@ jobs:
5548
checks: write
5649
contents: read
5750
steps:
58-
- uses: actions/[email protected]
51+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
52+
with:
53+
persist-credentials: false
5954
- name: Set up Go
60-
uses: actions/[email protected]
55+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
6156
with:
6257
go-version: "1.24.3"
6358
- name: Report health score
64-
uses: slackapi/[email protected]
59+
uses: slackapi/slack-health-score@d58a419f15cdaff97e9aa7f09f95772830ab66f7 # v0.1.1
6560
with:
6661
extension: "go"
6762
codecov_token: ${{ secrets.ELAINES_CODECOV_API_TOKEN }}

0 commit comments

Comments
 (0)