Skip to content

Commit ecc1117

Browse files
committed
fix: other fixes for ci/cd vulnerabilities
1 parent 7c13cf9 commit ecc1117

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

.github/workflows/autodoc_cicd.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
python-version: ${{ env.MAIN_PYTHON_VERSION }}
3636

3737
- name: "Cache pip"
38-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
38+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
3939
with:
4040
path: ~/.cache/pip
4141
key: Python-pyconverter-generatedcommands-v${{ env.RESET_PIP_CACHE_2 }}-${{ hashFiles('pyproject.toml') }}
@@ -59,7 +59,7 @@ jobs:
5959
6060
- name: "Create pyconverter-autogenerated package"
6161
run: |
62-
pyconverter-xml2py package -x ${{ github.workspace }}/mapdl-cmd-doc -f ${{ github.workspace }}/tests/customized_functions -l 100
62+
pyconverter-xml2py package -x ${GITHUB_WORKSPACE}/mapdl-cmd-doc -f ${GITHUB_WORKSPACE}/tests/customized_functions -l 100
6363
6464
- name: Upload autogenerated doc artifacts
6565
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -99,7 +99,7 @@ jobs:
9999
name: package
100100

101101
- name: "Cache pip"
102-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
102+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
103103
with:
104104
path: ~/.cache/pip
105105
key: Python-pyconverter-generatedcommands-v${{ env.RESET_PIP_CACHE_2 }}-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }}
@@ -116,15 +116,15 @@ jobs:
116116
echo "PyConverter-GeneratedCommands version is: $(python -c 'from pyconverter.generatedcommands import __version__; print(__version__)')"
117117
118118
- name: "Cache docs build directory"
119-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
119+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
120120
with:
121121
path: doc/_build
122122
key: doc-build-pyconverter-generatedcommands-v${{ env.RESET_DOC_BUILD_CACHE_2 }}-${{ inputs.PYCONVERTER_GENERATED_VERSION }}-${{ github.sha }}
123123
restore-keys: |
124124
doc-build-pyconverter-generatedcommands-v${{ env.RESET_DOC_BUILD_CACHE_2 }}-${{ inputs.PYCONVERTER_GENERATED_VERSION }}
125125
126126
- name: "Cache autosummary"
127-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
127+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
128128
with:
129129
path: doc/source/_autosummary/*.rst
130130
key: autosummary-pyconverter-generatedcommands-v${{ env.RESET_AUTOSUMMARY_CACHE_2 }}-${{ inputs.PYCONVERTER_GENERATED_VERSION }}-${{ github.sha }}

.github/workflows/ci_cd.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ env:
2323
RESET_DOC_BUILD_CACHE: 10
2424
ON_CI: true
2525

26+
permissions:
27+
contents: read
28+
pull-requests: read
29+
2630
concurrency:
2731
group: ${{ github.workflow }}-${{ github.ref }}
2832
cancel-in-progress: true
@@ -108,6 +112,8 @@ jobs:
108112
steps:
109113
- name: "Install Git and checkout project"
110114
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115+
with:
116+
persist-credentials: false
111117

112118
- name: "Setup Python"
113119
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
@@ -120,7 +126,7 @@ jobs:
120126
sudo apt-get install pandoc
121127
122128
- name: "Cache pip"
123-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
129+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
124130
with:
125131
path: ~/.cache/pip
126132
key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
@@ -135,6 +141,7 @@ jobs:
135141
ref: feat/pyconverter-xml2py-predifined-format
136142
token: ${{ secrets.MAPDL_CMD_DOC_TOKEN }}
137143
path: mapdl-cmd-doc
144+
persist-credentials: false
138145

139146
- name: "Unit testing requirements installation"
140147
run: |
@@ -143,7 +150,7 @@ jobs:
143150
- name: "Unit testing"
144151
run: |
145152
pytest -v --durations=10 --maxfail=10 \
146-
--reruns 7 --reruns-delay 3 --ghdir ${{ github.workspace }}\
153+
--reruns 7 --reruns-delay 3 --ghdir ${GITHUB_WORKSPACE}\
147154
--cov=pyconverter.xml2py --cov-report=xml:coverage.xml --cov-report=html\
148155
--cov-report term
149156
@@ -167,14 +174,16 @@ jobs:
167174
steps:
168175
- name: "Install Git and checkout project"
169176
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
177+
with:
178+
persist-credentials: false
170179

171180
- name: "Setup Python"
172181
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
173182
with:
174183
python-version: ${{ env.MAIN_PYTHON_VERSION }}
175184

176185
- name: "Cache pip"
177-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
186+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
178187
with:
179188
path: ~/.cache/pip
180189
key: Python-pyconverter.xml2py-v${{ env.RESET_PIP_CACHE }}-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }}
@@ -192,15 +201,15 @@ jobs:
192201
echo "pyconverter.xml2py version is: $(python -c 'from pyconverter.xml2py import __version__; print(__version__)')"
193202
194203
- name: "Cache docs build directory"
195-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
204+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
196205
with:
197206
path: doc/_build
198207
key: doc-build-pyconverter-xml2py-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ env.PYCONVERTER_VERSION }}-${{ github.sha }}
199208
restore-keys: |
200209
doc-build-pyconverter-xml2py-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ env.PYCONVERTER_VERSION }}
201210
202211
- name: "Cache autosummary"
203-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
212+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
204213
with:
205214
path: doc/source/**/_autosummary/**/*.rst
206215
key: autosummary-pyconverter-xml2py-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ env.PYCONVERTER_VERSION }}-${{ github.sha }}
@@ -277,6 +286,8 @@ jobs:
277286
# Deploy release documentation when creating a new tag
278287
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
279288
runs-on: ubuntu-latest
289+
permissions:
290+
contents: write
280291
needs: [release, release-pypi]
281292
steps:
282293
- name: "Deploy the stable documentation"
@@ -293,6 +304,8 @@ jobs:
293304
# Deploy development only when merging to main
294305
if: github.ref == 'refs/heads/main'
295306
runs-on: ubuntu-latest
307+
permissions:
308+
contents: write
296309
needs: [package]
297310
steps:
298311
- name: "Deploy the latest documentation"

.github/workflows/label.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
paths:
88
- '../labels.yml'
99

10+
permissions: {}
11+
1012
concurrency:
1113
group: ${{ github.workflow }}-${{ github.ref }}
1214
cancel-in-progress: true
@@ -16,8 +18,14 @@ jobs:
1618
label-syncer:
1719
name: Syncer
1820
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
issues: write
1925
steps:
2026
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
with:
28+
persist-credentials: false
2129
- uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
2230
env:
2331
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -68,7 +76,11 @@ jobs:
6876
labels: bug
6977

7078
commenter:
79+
name: Add comment to PR about label suggestions
7180
runs-on: ubuntu-latest
81+
permissions:
82+
pull-requests: write
83+
issues: write
7284
needs: labeler
7385
steps:
7486
- name: Suggest to add labels

0 commit comments

Comments
 (0)