Skip to content

Commit 93299e0

Browse files
committed
chore(actions): address zizmor findings
This PR is an AI assisted attempt to address zizmor findings. It may not catch everything, and should be reviewed by repository owners. If it is unhelpful, feel free to close the PR and address separately. If it is helpful, feel free to approve and merge, or edit/modify as needed to get it to the right state. Repository owners must ultimately ensure compliance by 2026-07-13. The purpose of this PR is to provide some assistance with achieving that as a first pass. This will become a blocking check for new changes to github workflows on 2026-07-13.
1 parent 4d870b3 commit 93299e0

4 files changed

Lines changed: 34 additions & 14 deletions

File tree

.github/workflows/codegen.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
permissions:
2+
contents: read
3+
14
on:
25
schedule:
36
# Runs daily at 00:18 UTC.
@@ -7,14 +10,14 @@ on:
710
name: codegen
811
jobs:
912
discovery:
10-
uses: googleapis/discovery-artifact-manager/.github/workflows/list-services.yml@master
13+
uses: googleapis/discovery-artifact-manager/.github/workflows/list-services.yml@master # zizmor: ignore[unpinned-uses]
1114
batch:
1215
runs-on: 'ubuntu-24.04'
1316
needs: discovery
1417
outputs:
1518
batches: ${{ steps.chunk.outputs.result }}
1619
steps:
17-
- uses: actions/github-script@v5
20+
- uses: actions/github-script@211cb3fefb35a799baa5156f9321bb774fe56294 # v5
1821
id: chunk
1922
with:
2023
script: |
@@ -34,9 +37,9 @@ jobs:
3437
indices
3538
}
3639
generate:
37-
uses: googleapis/google-api-java-client-services/.github/workflows/generate.yaml@main
40+
uses: googleapis/google-api-java-client-services/.github/workflows/generate.yaml@main # zizmor: ignore[unpinned-uses,secrets-inherit]
3841
needs: batch
39-
secrets: inherit
42+
secrets: inherit # zizmor: ignore[secrets-inherit]
4043
strategy:
4144
fail-fast: false
4245
matrix:

.github/workflows/generate.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
permissions:
2+
contents: read
3+
14
on:
25
workflow_dispatch:
36
inputs:
@@ -22,28 +25,34 @@ jobs:
2225
matrix:
2326
service: ${{fromJson(inputs.services)}}
2427
steps:
25-
- run: echo generating ${{ matrix.service }}
26-
- uses: actions/checkout@v2
28+
- run: echo generating ${MATRIX_SERVICE}
29+
env:
30+
MATRIX_SERVICE: ${{ matrix.service }}
31+
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
2732
with:
2833
fetch-depth: 1
2934
path: google-api-java-client-services
3035
token: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
31-
- uses: actions/checkout@v2
36+
persist-credentials: false
37+
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
3238
with:
3339
repository: googleapis/discovery-artifact-manager
3440
fetch-depth: 1
3541
path: discovery-artifact-manager
3642
token: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
37-
- uses: actions/setup-python@v5
43+
persist-credentials: false
44+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
3845
with:
3946
python-version: 3.8.18
4047
- run: |
4148
sudo apt update
4249
python3 --version
4350
pip install pip==21.3.1
4451
pip --version
45-
- run: ./google-api-java-client-services/.github/workflows/generate.sh ${{ matrix.service }}
46-
- uses: googleapis/code-suggester@v5
52+
- run: ./google-api-java-client-services/.github/workflows/generate.sh ${MATRIX_SERVICE}
53+
env:
54+
MATRIX_SERVICE: ${{ matrix.service }}
55+
- uses: googleapis/code-suggester@f9fef85aa02459e30e62526abe950341cbbd768b # v5
4756
env:
4857
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
4958
with:

.github/workflows/update-root-readme.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
permissions:
2+
contents: read
3+
14
on:
25
schedule:
36
# Runs at 03:00 am.
@@ -9,10 +12,11 @@ jobs:
912
update:
1013
runs-on: 'ubuntu-24.04'
1114
steps:
12-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
1316
with:
1417
fetch-depth: 1
1518
path: google-api-java-client-services
19+
persist-credentials: false
1620
- run: |
1721
sudo apt update
1822
sudo apt install python3
@@ -21,7 +25,7 @@ jobs:
2125
python3 get-pip.py
2226
python3 -m pip install --require-hashes -r ./google-api-java-client-services/.github/workflows/requirements.txt
2327
- run: python3 ./google-api-java-client-services/.github/workflows/update-root-readme.py
24-
- uses: googleapis/code-suggester@v2 # takes the changes from git directory
28+
- uses: googleapis/code-suggester@9222591646c050504e4a341ab8418cbfb5f619e1 # v2
2529
env:
2630
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
2731
with:

.github/workflows/verify.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
permissions:
2+
contents: read
3+
14
on:
25
schedule:
36
# Runs at 04:00 am
@@ -46,13 +49,14 @@ jobs:
4649
failed_libraries_y: ${{ steps.compile.outputs.failed_libraries_y }}
4750
failed_libraries_z: ${{ steps.compile.outputs.failed_libraries_z }}
4851
steps:
49-
- uses: actions/setup-java@v3
52+
- uses: actions/setup-java@17f84c3641ba7b8f6deff6309fc4c864478f5d62 # v3
5053
with:
5154
distribution: temurin
5255
java-version: 8
53-
- uses: actions/checkout@v2
56+
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
5457
with:
5558
path: google-api-java-client-services
59+
persist-credentials: false
5660

5761
- id: compile
5862
working-directory: google-api-java-client-services

0 commit comments

Comments
 (0)