Skip to content

Commit 0f959e1

Browse files
committed
ci: skip GH Pages publish from fork PRs
1 parent 92427b6 commit 0f959e1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,18 @@ jobs:
8989
preview:
9090
runs-on: ubuntu-latest
9191
needs: build
92-
if: ${{ needs.build.outputs.any-workspace == 'true' }}
92+
# We don't want to give forks free reign to publish to our GH Pages, so run this job only if both:
93+
# - any workspace changed (otherwise there's no work to do)
94+
# - and either
95+
# - this is not a PR (so it's some other event that happened in our fork, like a push or merge group)
96+
# - or it's a PR from our fork (not some other fork)
97+
if: ${{
98+
(needs.build.outputs.any-workspace == 'true') &&
99+
(
100+
(!github.event.pull_request) ||
101+
(github.event.pull_request.head.repo.full_name == github.repository)
102+
)
103+
}}
93104
name: Publish preview playgrounds to GH Pages
94105
steps:
95106
- name: Determine GitHub Pages directory name

0 commit comments

Comments
 (0)