Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

GitHub Action to check out the merge commit of a pull request

Notifications You must be signed in to change notification settings

MattiasBuelens/checkout-pull-request-merge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

checkout-pull-request-merge (DEPRECATED)

Checks out the merge commit of a pull request.

This GitHub Action was written for the old HCL syntax, which is no longer supported.

Alternative

With the new YAML syntax, you can pass the merge_commit_sha from the pull_request event payload as ref parameter to actions/checkout:

name: Test on pull request
on: [pull_request]
jobs:
  test_pull_request:
    runs-on: ubuntu-latest
    steps:
      - name: Check out merge commit of pull request
        uses: actions/checkout@v1
        with:
          ref: ${{ github.event.pull_request.merge_commit_sha }}
      - name: Test
        run: npm install && npm test

You can then use jobs.<job_id>.if to only run your job when it's possible to merge the pull request:

name: Test on pull request
on: [pull_request]
jobs:
  test_pull_request:
    # Run only on non-merged non-draft mergeable pull requests
    if: |
      !(
        (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize')
        && !github.event.pull_request.draft
        && !github.event.pull_request.merged
        && github.event.pull_request.merge_commit_sha != null
      )
    runs-on: ubuntu-latest
    steps:
      # ...

For a complete example, see this workflow.

About

GitHub Action to check out the merge commit of a pull request

Resources

Stars

Watchers

Forks

Packages

No packages published