Making PR check actions run again when base branch is pushed


I’m trying to figure out how to make actions that run on: [pull_request] run again when the base branch of a PR is pushed.

The documentation seems to suggest that this should just happen because it’s set to run on the synchronize action by default, but that doesn’t seem to be happening. I also tried manually enabling it for the synchronize action, but that didn’t help either.

Am I missing something?



1 Like

Hi @sauyon ,

‘push’ on base branch will not trigger the pull request event. 

The commit from base branch will not be added into the PR commit list, that’s why ‘pull_request:synchronize’ is not triggered. However commit on source branch will be.

As an alternative, you can close current PR and create a new pull for check runs. Please check rest api doc for more details. Code sample as below.

name: recreatePR
on: [push]
# add type 'reopended' for pull request event in source branch.
    runs-on: [ubuntu-latest]
      - name: Dump GitHub context
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - name: close current PR
        run: |
          curl --request PATCH \
          --url${{ github.repository }}/pulls/34 \
          --header 'authorization: Bearer ${{ secrets.PAT3 }}' \
          --data '{"state": "closed"}'
      - name: recreate a pull request
        run: |
          curl --request POST \
          --url${{ github.repository }}/pulls \
          --header 'authorization: Bearer ${{ secrets.PAT3 }}' \
          --data '{
            "title": "New Pull request",
            "body": "Please pull these awesome changes in!",
            "head": "B108", # source branch
            "base": "master" # base branch
1 Like

We would like this feature as well. Being able to force a re-run when the base changes would allow us to catch breaking changes due to other PR merges. This is really needed before we could consider using Github actions on a larger scale. Without it we risk getting a broken main branch, which is unacceptable.

1 Like

It is a good idea to close and reopen pr.
When the base branch of a PR is pushed, the PR’s close and reopen process should be conducted automatically.

Your sample code has hard coding such as the url${{ github.repository }}/pulls/34
so it seems not to work…