Trigger an action on pull request when master has a new commit?


Here’s my use case: I want a check to re-run ON ALL OPEN PULL REQUESTS when there’s a new commit in master, but not all checks. Or to put it in another way, re-run a check on PR when its base branch has a new commit.
This particular check is to ensure certain property (database migration serial number), but running all checks (requires up to date) would be very slow and unnecessary.

Is there any way this is possible? Thanks!

A few alternative considered (w/ or w/o actions):

  • Branch protection: Doesn’t allow “require up-to-date” ONLY TO CERTAIN CHECKS

There is no specific event that exists today that you could listen to that would trigger when the target branch updates on an existing Pull Request.

An option you could try would be to track the target branch and fire an action on a commit in that branch and then use the actions/github-script action where you can provide some custom JavaScript scripting to get the open Pull Requests via the octokit client and filter to those that include the branch you are interested in as the target.

From there you could re-trigger another action that contains the check(s) that you are looking to re-run using a repository_dispatch event that contains a payload of the PR/branch/ref that you want to re-run the check on.