Skip to content

github actions run a job on pull request merge to specific branch #67160

Answered by elendil7
ash-dey-sa asked this question in Actions
Discussion options

You must be logged in to vote

Option [1]

Hello. A potential workaround could be removing the following snippet:
if: ${{ github.ref == 'refs/heads/develop' && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
And instead relying solely on the following configuration:

on:
  pull_request:
    # For the develop branch only.
    branches:
      - develop
    # Execute the action on closed (merged) PR.
    types:
      [closed]
    workflow_dispatch:

Note: I removed all branches except "develop" from the branches field. If you have separate jobs that run on those branches, consider making another GitHub Actions yml file for this job specifically. Abstractio…

Replies: 3 comments 3 replies

This comment was marked as off-topic.

Comment options

You must be logged in to vote
2 replies
@P-mistry
Comment options

@DavidATapia
Comment options

Answer selected by ash-dey-sa
Comment options

You must be logged in to vote
1 reply
@elendil7
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
4 participants