Skip to content

Commit 1191f8d

Browse files
authored
BUG - Update release workflow permissions (#2162)
This is a follow-up to #2077. This PR fixes action permissions to call reusable workflows in our release workflow. I also pinned the SHA for a workflow I missed in a previous review.
1 parent afc87be commit 1191f8d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/CI.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,13 @@ jobs:
194194
# Calling the coverage-comment action from the main CI workflow
195195
# we might want to pin the SHA once merged
196196
coverage-comment:
197-
uses: ./.github/workflows/coverage.yml
197+
# Important: make sure to update the SHA after making any changes to the coverage workflow
198+
uses: pydata/pydata-sphinx-theme/.github/workflows/coverage.yml@4a1e7898d6c92dade5e489684277ab4ffd0eb053
198199
needs: [coverage]
200+
# ensures this runs even if the coverage step does not continue - e.g. the
201+
# default coverage action will fail at first for external PRs, this is a workaround
202+
# to ensure the comment is posted
203+
if: ${{ always() }}
199204
permissions:
200205
contents: write
201206
pull-requests: write

.github/workflows/publish.yml

+9
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,26 @@ jobs:
2020
tests:
2121
# Important: make sure to update the SHA after making any changes to the CI workflow
2222
uses: pydata/pydata-sphinx-theme/.github/workflows/CI.yml@4a1e7898d6c92dade5e489684277ab4ffd0eb053
23+
# only run this workflow for pydata owned repositories (avoid forks)
24+
if: github.repository_owner == 'pydata'
2325
# needed for the coverage action
2426
permissions:
2527
contents: write
2628
pull-requests: write
29+
actions: read
2730
# calls our docs workflow (build docs, check broken links, lighthouse)
2831
docs:
2932
# Important: make sure to update the SHA after making any changes to the docs workflow
3033
uses: pydata/pydata-sphinx-theme/.github/workflows/docs.yml@4a1e7898d6c92dade5e489684277ab4ffd0eb053
34+
# only run this workflow for pydata owned repositories (avoid forks)
35+
if: github.repository_owner == 'pydata'
3136

3237
build-package:
3338
name: "Build & verify PST package"
3439
# require tests and docs to pass before building the package
3540
needs: [tests, docs]
41+
# only run this workflow for pydata owned repositories (avoid forks)
42+
if: github.repository_owner == 'pydata'
3643
runs-on: ubuntu-latest
3744
steps:
3845
- name: "Checkout repository 🛎"
@@ -69,6 +76,8 @@ jobs:
6976
release-PST:
7077
runs-on: ubuntu-latest
7178
needs: [build-package]
79+
# only run this workflow for pydata owned repositories (avoid forks)
80+
if: github.repository_owner == 'pydata'
7281
permissions:
7382
id-token: write # needed for PyPI upload
7483
environment:

0 commit comments

Comments
 (0)