Skip to content

Commit 3bedfe3

Browse files
authored
Merge pull request #2374 from IntelPython/harden-github-actions-workflows
ci: harden GitHub Actions workflows and add zizmor scan
2 parents 012de53 + f443bd2 commit 3bedfe3

11 files changed

Lines changed: 75 additions & 12 deletions

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ updates:
55
schedule:
66
interval: "weekly"
77
day: "saturday"
8+
cooldown:
9+
default-days: 7
810
labels: ["autoupdate"]
911
groups:
1012
github-actions:
@@ -15,6 +17,8 @@ updates:
1517
schedule:
1618
interval: "weekly"
1719
day: "saturday"
20+
cooldown:
21+
default-days: 7
1822
labels: ["autoupdate"]
1923
groups:
2024
pre-commit:

.github/workflows/backfill-docs.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
required: true
88
type: string
99

10-
permissions: read-all
10+
permissions:
11+
contents: read
1112

1213
env:
1314
CHECK_CONFIG_SCRIPT: "import sys; from packaging.version import parse; print('true' if parse('0.17.0') <= parse(sys.argv[1]) < parse('0.22.0') else 'false')"
@@ -67,8 +68,10 @@ jobs:
6768
persist-credentials: false
6869
- name: Inject new docs configuration
6970
shell: bash -l {0}
71+
env:
72+
TAG: ${{ github.event.inputs.tag }}
7073
run: |
71-
NEEDS_CONFIG=$(python -c "${{ env.CHECK_CONFIG_SCRIPT }}" "${{ github.event.inputs.tag }}")
74+
NEEDS_CONFIG=$(python -c "$CHECK_CONFIG_SCRIPT" "$TAG")
7275
7376
if [[ "${NEEDS_CONFIG}" == "true" ]]; then
7477
git fetch origin master

.github/workflows/conda-package-cf.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ on:
66
- master
77
pull_request:
88

9-
permissions: read-all
9+
permissions:
10+
contents: read
1011

1112
env:
1213
PACKAGE_NAME: dpctl
@@ -41,6 +42,7 @@ jobs:
4142

4243
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4344
with:
45+
persist-credentials: false
4446
fetch-depth: 0
4547

4648
- name: Set pkgs_dirs
@@ -109,6 +111,7 @@ jobs:
109111
# the recipe takes the version from git describe
110112
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
111113
with:
114+
persist-credentials: false
112115
fetch-depth: 0
113116

114117
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1

.github/workflows/conda-package.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ on:
66
- master
77
pull_request:
88

9-
permissions: read-all
9+
permissions:
10+
contents: read
1011

1112
env:
1213
PACKAGE_NAME: dpctl
@@ -41,6 +42,7 @@ jobs:
4142

4243
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4344
with:
45+
persist-credentials: false
4446
fetch-depth: 0
4547

4648
- name: Set pkgs_dirs
@@ -118,6 +120,7 @@ jobs:
118120

119121
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
120122
with:
123+
persist-credentials: false
121124
fetch-depth: 0
122125

123126
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
@@ -618,6 +621,7 @@ jobs:
618621
- name: Checkout dpctl repo
619622
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
620623
with:
624+
persist-credentials: false
621625
fetch-depth: 0
622626
- name: Download artifact
623627
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -788,6 +792,7 @@ jobs:
788792
- name: Checkout repo
789793
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
790794
with:
795+
persist-credentials: false
791796
repository: IntelPython/devops-tools
792797
fetch-depth: 0
793798

.github/workflows/generate-coverage.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
push:
55
branches: [master]
66

7-
permissions: read-all
7+
permissions:
8+
contents: read
89

910
jobs:
1011
generate-coverage:
@@ -82,6 +83,7 @@ jobs:
8283
- name: Checkout repo
8384
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
8485
with:
86+
persist-credentials: false
8587
fetch-depth: 0
8688

8789
- name: Install Lcov

.github/workflows/generate-docs.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened, closed]
88

9-
permissions: read-all
9+
permissions:
10+
contents: read
1011

1112
jobs:
1213
build-and-deploy:
@@ -143,7 +144,7 @@ jobs:
143144
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed' }}
144145
env:
145146
PR_NUM: ${{ github.event.number }}
146-
uses: mshick/add-pr-comment@ec328af66588ab8f77cdeb2c264f14aba45bbf59 # v3.12.0.8.3.12.0
147+
uses: mshick/add-pr-comment@ec328af66588ab8f77cdeb2c264f14aba45bbf59 # v3.12.0
147148
with:
148149
message: |
149150
View rendered docs @ https://intelpython.github.io/dpctl/pulls/${{ env.PR_NUM }}/index.html
@@ -152,7 +153,7 @@ jobs:
152153
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action == 'closed' }}
153154
env:
154155
PR_NUM: ${{ github.event.number }}
155-
uses: mshick/add-pr-comment@ec328af66588ab8f77cdeb2c264f14aba45bbf59 # v3.12.0.8.3.12.0
156+
uses: mshick/add-pr-comment@ec328af66588ab8f77cdeb2c264f14aba45bbf59 # v3.12.0
156157
with:
157158
message: |
158159
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. :crossed_fingers:

.github/workflows/openssf-scorecard.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ on:
1616
branches: [ "master" ]
1717

1818
# Declare default permissions as read only.
19-
permissions: read-all
19+
permissions:
20+
contents: read
2021

2122
jobs:
2223
analysis:

.github/workflows/os-llvm-sycl-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
push:
55
branches: [master]
66

7-
permissions: read-all
7+
permissions:
8+
contents: read
89

910
jobs:
1011
install-compiler:
@@ -128,6 +129,7 @@ jobs:
128129
- name: Checkout repo
129130
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
130131
with:
132+
persist-credentials: false
131133
fetch-depth: 0
132134

133135
- name: Create set_allvars.sh

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ on:
55
push:
66
branches: [master]
77

8-
permissions: read-all
8+
permissions:
9+
contents: read
910

1011
jobs:
1112
pre-commit:
@@ -18,6 +19,7 @@ jobs:
1819
- name: Checkout dpctl
1920
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2021
with:
22+
persist-credentials: false
2123
ref: ${{ github.sha }} # use hash to pass no-commit-to-branch check
2224
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
2325
with:

.github/workflows/run-tests-from-dppy-bits.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ on:
99
- cron: '28 2 * * *'
1010
workflow_dispatch:
1111

12-
permissions: read-all
12+
permissions:
13+
contents: read
1314

1415
env:
1516
MODULE_NAME: dpctl

0 commit comments

Comments
 (0)