Skip to content
Prev Previous commit
Don't run CI for PRs without approval
  • Loading branch information
seadowg committed Nov 4, 2025
commit 9c193f0ae903fb08c9e83e94b3d24301b1347229
19 changes: 18 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,24 @@ workflows:
version: 2
commit:
jobs:
- compile
- hold_pr:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I often find that I might be committing/pushing quickly and that context, CI will be constantly starting and cancelling workflow runs. Add a manual approval step means we only end up running jobs when we actually care about the result. I'd like to try this, but definitely let me know if you feel like it's getting annoying @grzesiek2010.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your rationale, but isn’t it possible to differentiate between draft and ready-for-review PRs and trigger jobs only for those that are ready for review?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! It looks like this might be possible with the new Github triggers, but I'm not sure that we'd be able to have it always run for non-drafts and optionally for drafts (you still probably want CI on request for drafts). We could always just use the GitHub API (probably through gh).

I think that's probably a future improvement though: I think we either go with the basic version as-is or remove the hold_pr check for now.

type: approval
filters:
branches:
ignore:
- master
- compile:
filters:
branches:
only:
- master
- compile:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have two jobs with the same name (compile)? Does it work or one replaces the other?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They both reference the compile job definition - this isn't declaring the job. One runs on master only and the other only on non-master.

requires:
- hold_pr
filters:
branches:
ignore:
- master
- check_quality:
requires:
- compile
Expand Down