How to run Circle CI job on pull request branch only when PR is approved?

Is there any command for a job so it can be triggered only when PR is actually approved?

I’m not aware of an easy way to do that natively, and I don’t think there’s any kind of webhook / event that fires to Circle when a PR is approved anyway? [edit: looks like the OP edited the question / description, but the original question was about having a checkbox in the PR description / comments, I think]

It seems even with GHA (which does have support to deal with certain types of different events that happen within GitHub) it’s not totally possible in-house?

  • You can add a manual approval step (but someone with permissions to run the approval would be able to approve in the Circle UI whether or not the PR was).
  • You can, of course, have a pipeline that runs on the default branch after the PR is merged.

For specialized uses (Atlantis, for example, uses a similar workflow to this, where Terraform changes are applied after approval, but before merge), that’s typically implemented within that system natively.

can you try this solution:

Add the following filter configuration to the job:

filters:
  branches:
    only: /.*/
    ignore: /.*\/PR[-_].*/

With this configuration, the job will only be triggered when a PR is approved and not when a new PR is opened. The ignore parameter excludes branches that start with “PR-” or “PR_”, ensuring that the job is only triggered when a PR is approved and not when it is initially created.

Make sure to adjust the configuration based on your specific needs and branch naming conventions.

please do let me know if this did help or if it did not work for you