Action that opens a PR not trigger another workflow

I have a GitHub action that opens a pull request when there are commits to a specific branch:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
  open-pull-request:
    name: open pull request
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Repo
      uses: actions/checkout@v2
    - name: Create Pull Request
      uses: repo-sync/pull-request@v2
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
name: pr-automation
"on":
  push:
    branches:
    -automation

And I also have a workflow that runs with event { on: pull-request { branches: master } } }

When the there’s a commit to the automation branch, I’d expect 2 workflows to run:

  • The automation workflow which opens a pull request
  • the pull request workflow, because a new PR has been opened against master

The second workflow isn’t currently running. I suspect it may be related to the GITHUB_TOKEN permissions, but I can’t be sure. Any pointers?

Unless the token is your personal access token, actions will not trigger other acctions - to prevent endless loops.

To remedy that, simply create a personal access token, store it as a secret and use that secret instead.

I did try that, by passing the PAT to the “open pull request” job. It didn’t seem to rectify the issue.

Just asking, isn’t that a syntax error: -automation - shouldn’t it be - automation (with a space)?

yes, it was a copy/paste fail - the original workflow seems fine

1 Like