Skip to content

Trigger job on push on commit which is in a PR via if condition #26356

Discussion options

You must be logged in to vote

Awesome, thanks for the context! So in this case you should be able to look at the event_name item inside the github context object.

        steps:
            - name: deploy
              if: github.event_name == 'pull_request'
              run: ...

You could also specifically only listen for pushes to the pull request too:

              if: github.event_name == 'pull_request' && github.event.action == 'synchronize'

You can see the syntax for constructing these statements here:

docs.github.com

Context and expression syntax for GitHub Actions - GitHub Docs

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants