Skip to content

Commit 2b146f8

Browse files
feat(ci): add is_forked_pull_request parameter to CircleCI configuration (#755)
* feat(ci): add is_forked_pull_request parameter to CircleCI configuration * fix(ci): remove unnecessary blank line in CircleCI configuration * feat(ci): add support for forked pull requests in configuration diff workflows * docs: clarify CircleCI checks requirements for pull requests * nit * docs: update CONTRIBUTING.md to remove redundant information about CircleCI checks
1 parent a227903 commit 2b146f8

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

.circleci/artifact_upload_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ parameters:
1010
chain:
1111
type: string
1212
default: "__required__"
13+
is_forked_pull_request:
14+
type: boolean
15+
default: false
1316

1417
commands:
1518
gcp-oidc-authenticate:

.circleci/config.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ jobs:
3535
- run:
3636
name: Generate Configuration
3737
command: |
38-
39-
echo "{}" > .circleci/parameters.json
38+
if [[ $CIRCLE_BRANCH == pull/* ]]; then
39+
is_forked_pull_request=true
40+
else
41+
is_forked_pull_request=false
42+
fi
43+
echo "{\"is_forked_pull_request\":$is_forked_pull_request}" > .circleci/parameters.json
4044
4145
if [ "<< pipeline.parameters.chain >>" = "__required__" ]; then
4246
# This will always be selected unless the user chooses to interact with the configuration by setting a non default value in the chain parameter. This would happens if the user launch the pipeline with a specific chain value via either curl or the CircleCI GUI.

.circleci/main_config.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ parameters:
1010
chain:
1111
type: string
1212
default: "__required__"
13+
is_forked_pull_request:
14+
type: boolean
15+
default: false
1316

1417
commands:
1518
notify-failures-on-main:
@@ -407,6 +410,8 @@ workflows:
407410
- check-codegen
408411

409412
compute-config-diff-and-report:
413+
when:
414+
not: << pipeline.parameters.is_forked_pull_request >>
410415
jobs:
411416
- compute-config-diff:
412417
name: compute-genesis-diff
@@ -430,3 +435,17 @@ workflows:
430435
message: "Detected nonzero diff in rollup config. This PR modifies the configuration of at least one chain in the registry, which may or may not have been intended"
431436
context: circleci-superchain-registry
432437
requires: [compute-rollup-config-diff]
438+
439+
compute-config-diff-only:
440+
when: << pipeline.parameters.is_forked_pull_request >>
441+
jobs:
442+
- compute-config-diff:
443+
name: compute-genesis-diff
444+
command: "generate-genesis"
445+
save_to: "GENESIS"
446+
directory: "generate-genesis"
447+
- compute-config-diff:
448+
name: compute-rollup-config-diff
449+
command: "generate-rollup-config"
450+
save_to: "ROLLUP"
451+
directory: "generate-rollup-config"

CONTRIBUTING.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,13 @@ See [Superchain Upgrades] OP Stack specifications.
180180
[Superchain Upgrades]: https://specs.optimism.io/protocol/superchain-upgrades.html
181181

182182
## CircleCI Checks
183-
184-
The following CircleCI checks are required and must pass before submitting a pull request:
183+
The following CircleCI checks are not mandatory for submitting a pull request, but they should be reviewed:
185184

186185
- `ci/circleci: compute-genesis-diff`
187186
- `ci/circleci: compute-rollup-config-diff`
188187

189-
If these checks did not run, they can be triggered manually from CircleCI without any parameters or by submitting and empty commit after the PR has being created.
188+
These jobs will run at every commit in every branch.
189+
190+
For pull requests from forks, these checks will not appear directly in the PR comments, but **the jobs will still run** and their results can be viewed in the diffs.
191+
192+
Please note that while these jobs are **not blocking**, they must pass to ensure the accuracy of the changes.

0 commit comments

Comments
 (0)