Skip to content

Commit eb29c20

Browse files
authored
Merge pull request #66 from z-shell/feature-zsh1-zd-workflow-pinning
ci(workflows): pin actions to SHAs + least-privilege permissions
2 parents 36ae804 + b56b206 commit eb29c20

4 files changed

Lines changed: 36 additions & 18 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ on:
1919
schedule:
2020
- cron: "17 7 * * 2"
2121

22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
2229
jobs:
2330
analyze:
2431
name: Analyze (${{ matrix.language }})
@@ -55,7 +62,7 @@ jobs:
5562
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
5663
steps:
5764
- name: Checkout repository
58-
uses: actions/checkout@v4
65+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
5966

6067
# Add any setup steps before running the `github/codeql-action/init` action.
6168
# This includes steps like installing compilers or runtimes (`actions/setup-node`
@@ -65,7 +72,7 @@ jobs:
6572

6673
# Initializes the CodeQL tools for scanning.
6774
- name: Initialize CodeQL
68-
uses: github/codeql-action/init@v4
75+
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4
6976
with:
7077
languages: ${{ matrix.language }}
7178
build-mode: ${{ matrix.build-mode }}
@@ -94,6 +101,6 @@ jobs:
94101
exit 1
95102
96103
- name: Perform CodeQL Analysis
97-
uses: github/codeql-action/analyze@v4
104+
uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4
98105
with:
99106
category: "/language:${{matrix.language}}"

.github/workflows/docker.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
pull_request:
1616
branches: [main]
1717

18+
permissions:
19+
contents: read
20+
packages: write
21+
1822
concurrency:
1923
group: ${{ github.workflow }}-${{ github.ref }}
2024
cancel-in-progress: true
@@ -33,23 +37,23 @@ jobs:
3337
- { zsh_version: "5.8.1" }
3438
- { zsh_version: "5.9" }
3539
steps:
36-
- uses: actions/checkout@v4
40+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3741
with:
3842
token: ${{ secrets.GITHUB_TOKEN }}
39-
- uses: docker/setup-qemu-action@v4
43+
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4
4044
- name: Set up Docker Buildx
4145
id: buildx
42-
uses: docker/setup-buildx-action@v4
46+
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
4347
with:
4448
use: true
45-
- uses: docker/login-action@v4
49+
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
4650
with:
4751
registry: ghcr.io
4852
username: ${{ github.actor }}
4953
password: ${{ secrets.GITHUB_TOKEN }}
5054
- name: Build and push
5155
id: docker_build_zsh_versions
52-
uses: docker/build-push-action@v7
56+
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
5357
timeout-minutes: 60
5458
with:
5559
push: ${{ github.event.number == 0 }}
@@ -64,23 +68,23 @@ jobs:
6468
build-latest:
6569
runs-on: ubuntu-latest
6670
steps:
67-
- uses: actions/checkout@v4
71+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
6872
with:
6973
token: ${{ secrets.GITHUB_TOKEN }}
70-
- uses: docker/setup-qemu-action@v4
74+
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4
7175
- name: Set up Docker Buildx
7276
id: buildx
73-
uses: docker/setup-buildx-action@v4
77+
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
7478
with:
7579
use: true
76-
- uses: docker/login-action@v4
80+
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
7781
with:
7882
registry: ghcr.io
7983
username: ${{ github.actor }}
8084
password: ${{ secrets.GITHUB_TOKEN }}
8185
- name: Build and push
8286
id: docker_build_latest
83-
uses: docker/build-push-action@v7
87+
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
8488
if: github.ref == 'refs/heads/main'
8589
with:
8690
push: true

.github/workflows/test-matrix.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
matrix:
1717
zsh_version: ["5.5.1", "5.6.2", "5.7.1", "5.8", "5.8.1", "5.9"]
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2020

2121
- name: Set up Docker Buildx
22-
uses: docker/setup-buildx-action@v4
22+
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
2323

2424
- name: "Build image for Zsh ${{ matrix.zsh_version }}"
25-
uses: docker/build-push-action@v7
25+
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
2626
with:
2727
context: .
2828
file: docker/Dockerfile

.github/workflows/zsh-n.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,21 @@ on:
1313
- "tests/**"
1414
workflow_dispatch: {}
1515

16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
1623
jobs:
1724
zsh-matrix:
1825
runs-on: ubuntu-latest
1926
outputs:
2027
matrix: ${{ steps.set-matrix.outputs.matrix }}
2128
steps:
2229
- name: ⤵️ Check out code from GitHub
23-
uses: actions/checkout@v4
30+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2431
with:
2532
submodules: recursive
2633
- name: "✨ Set matrix output"
@@ -38,7 +45,7 @@ jobs:
3845
matrix: ${{ fromJSON(needs.zsh-matrix.outputs.matrix) }}
3946
steps:
4047
- name: ⤵️ Check out code from GitHub
41-
uses: actions/checkout@v4
48+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
4249
with:
4350
submodules: recursive
4451
- name: "⚡ Install dependencies"

0 commit comments

Comments
 (0)