Skip to content

Commit c49d435

Browse files
authored
Merge pull request #338 from tacaswell/harden_gha
CI: Harden GHA configuration
2 parents 47bad2b + 0f8afd0 commit c49d435

File tree

7 files changed

+26
-2
lines changed

7 files changed

+26
-2
lines changed

.github/workflows/black.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Style - BLACK
2+
permissions:
3+
contents: read
24

35
on: [push, pull_request]
46

@@ -7,6 +9,8 @@ jobs:
79
runs-on: ubuntu-latest
810
steps:
911
- uses: actions/checkout@v2
12+
with:
13+
persist-credentials: false
1014
- uses: actions/setup-python@v2
1115
with:
1216
python-version: 3.11

.github/workflows/docs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Documentation
2+
permissions:
3+
contents: read
24

35
on: [push, pull_request]
46

@@ -13,6 +15,8 @@ jobs:
1315

1416
steps:
1517
- uses: actions/checkout@v2
18+
with:
19+
persist-credentials: false
1620
- name: Set up Python ${{ matrix.python-version }}
1721
uses: actions/setup-python@v2
1822
with:

.github/workflows/docs_publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}
2222
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV
2323
- uses: actions/checkout@v2
24+
with:
25+
persist-credentials: false
2426
- name: Set up Python ${{ matrix.python-version }}
2527
uses: actions/setup-python@v2
2628
with:
@@ -42,7 +44,7 @@ jobs:
4244
- name: Deploy documentation to nsls-ii.github.io
4345
# We pin to the SHA, not the tag, for security reasons.
4446
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
45-
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
47+
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
4648
with:
4749
deploy_key: ${{ secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY }}
4850
publish_branch: master

.github/workflows/flake8.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Style - FLAKE8
2+
permissions:
3+
contents: read
24

35
on: [push, pull_request]
46

@@ -7,6 +9,8 @@ jobs:
79
runs-on: ubuntu-latest
810
steps:
911
- uses: actions/checkout@v2
12+
with:
13+
persist-credentials: false
1014
- uses: actions/setup-python@v2
1115
- name: Install Dependencies
1216
run: |

.github/workflows/isort.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Check Code Style - ISORT
2+
permissions:
3+
contents: read
24

35
on: [push, pull_request]
46

@@ -7,6 +9,8 @@ jobs:
79
runs-on: ubuntu-latest
810
steps:
911
- uses: actions/checkout@v2
12+
with:
13+
persist-credentials: false
1014
- uses: actions/setup-python@v2
1115
- name: Install Dependencies
1216
run: |

.github/workflows/python-publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v2
19+
with:
20+
persist-credentials: false
1921
- name: Set up Python
2022
uses: actions/setup-python@v2
2123
with:

.github/workflows/testing.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Tests
2+
permissions:
3+
contents: read
24

35
on:
46
push:
@@ -43,14 +45,16 @@ jobs:
4345

4446
steps:
4547
- uses: actions/checkout@v2
48+
with:
49+
persist-credentials: false
4650

4751
- name: Set up Python ${{ matrix.python-version }}
4852
uses: actions/setup-python@v2
4953
with:
5054
# This step is not expected to influence the test, since the test is run in Conda environment
5155
python-version: 3.9
5256

53-
- uses: conda-incubator/setup-miniconda@v2
57+
- uses: conda-incubator/setup-miniconda@9f54435e0e72c53962ee863144e47a4b094bfd35 # v2
5458
with:
5559
# miniforge-variant: Mambaforge
5660
miniforge-version: latest

0 commit comments

Comments
 (0)