Skip to content

Commit 2b3bd3c

Browse files
atergaclaude
andauthored
ci: add pull_request trigger to enable CI on fork PRs (dfinity#3782)
## Summary - Add `pull_request` trigger to `canister-tests.yml`, `frontend-checks.yml`, and `rust.yml` - Currently these workflows only trigger on `push`, so fork PRs never get CI checks - With `pull_request` added, maintainers see an "Approve and run" button to trigger CI on external contributions ## Notes - Some jobs reference `secrets.GIX_BOT_PAT`, which is not available to `pull_request` runs from forks. Steps that depend on this token (e.g., auto-commit formatting fixes) will be skipped or fail on fork PRs, but the core checks (build, test, lint) should still work. - The repo setting at **Settings > Actions > General > Fork pull request workflows** controls which contributors require approval. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e335285 commit 2b3bd3c

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/canister-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ name: Canister tests
55

66
on:
77
push:
8+
pull_request:
89

910
jobs:
1011
#####################
@@ -692,6 +693,7 @@ jobs:
692693
# This prepares all the files necessary for a release (all flavors of Wasm, release notes).
693694
# On release tags, a new release is created and the assets are uploaded.
694695
release:
696+
if: github.event_name != 'pull_request'
695697
runs-on: ubuntu-latest
696698
needs:
697699
[

.github/workflows/frontend-checks.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Frontend checks and lints
22

33
on:
44
push:
5+
pull_request:
56

67
jobs:
78
frontend-checks:
@@ -10,7 +11,7 @@ jobs:
1011
- uses: actions/checkout@v4
1112
with:
1213
# set a PAT so that add-and-commit can trigger CI runs
13-
token: ${{ secrets.GIX_BOT_PAT }}
14+
token: ${{ secrets.GIX_BOT_PAT || github.token }}
1415
- uses: ./.github/actions/setup-node
1516
- run: npm ci
1617
- name: Run tsc
@@ -37,8 +38,9 @@ jobs:
3738
done < <(jq <src/frontend/src/flows/dappsExplorer/dapps.json -cMr '.[] | .logo' )
3839
- name: Commit type interfaces
3940
uses: EndBug/add-and-commit@v9
40-
# We don't want to commit automatic changes to main
41-
if: ${{ github.ref != 'refs/heads/main' }}
41+
# We don't want to commit automatic changes to main, and we can't
42+
# push to fork PRs (read-only token).
43+
if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }}
4244
with:
4345
add: |
4446
src/frontend/generated

.github/workflows/rust.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Rust
33

44
on:
55
push:
6+
pull_request:
67

78
jobs:
89
cargo-fmt:
@@ -12,7 +13,7 @@ jobs:
1213
with:
1314
# set a PAT so that add-and-commit can trigger
1415
# CI runs
15-
token: ${{ secrets.GIX_BOT_PAT }}
16+
token: ${{ secrets.GIX_BOT_PAT || github.token }}
1617
- uses: ./.github/actions/bootstrap
1718

1819
- name: Cargo fmt
@@ -28,8 +29,9 @@ jobs:
2829
2930
- name: Commit Formatting changes
3031
uses: EndBug/add-and-commit@v9
31-
# We don't want to commit formatting changes to main
32-
if: ${{ github.ref != 'refs/heads/main' }}
32+
# We don't want to commit formatting changes to main, and we can't
33+
# push to fork PRs (read-only token).
34+
if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }}
3335
with:
3436
add: "**/*.rs"
3537
default_author: github_actions

0 commit comments

Comments
 (0)