2

Currently using the Submit Pull Request where it will automatically create a pull request for the branch but I wanted to it to run only for the first time I committed a branch, how do I stop it from running in other times?

name: create-pull-request workflow
on:
  push:
    branches:
      - '*'
      - '!master'
jobs:
  SubmitPullRequest:
    runs-on: ubuntu-latest
    steps:
      - name: Submit Pul Request
        uses: shimewtr/submit_pull_request@master
        env:
          ASSIGN: false
          GITHUB_ACCESS_TOKEN: ${{secrets.github_token}}
torek
  • 448,244
  • 59
  • 642
  • 775
Arthur
  • 318
  • 1
  • 4
  • 11
  • There are other actions on the marketplace that does the same thing (opening a PR automatically), preventing duplicated PRs. I could recomment [this one](https://github.com/repo-sync/pull-request) or [this other one](https://github.com/GuillaumeFalourd/pull-request-action). Or do you want to prevent the workflow for running if the PR has already been created? – GuiFalourd Apr 09 '22 at 18:14
  • if possible prevent the workflow from running if there is already a pr, to prevent any further usage of the actions quota – Arthur Apr 10 '22 at 02:52
  • For what I tested and read, you won't be able to check at the WORKFLOW level if a PR already exists or not, you would need to enter a JOB to do so. However, you could divide the workflow in 2 JOBS (or even 2 workflow FILES), where a first instance would check if the PR exists or not, and if not, create the PR for you automatically. That way, the second instance would only be run when necessary (not everytime). – GuiFalourd Apr 10 '22 at 13:33

0 Answers0