Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Github Action for finding the Pull Request (PR) associated with the current SHA.

Notifications You must be signed in to change notification settings

bettermarks/gh-find-current-pr

 
 

Repository files navigation

gh-find-current-pr

This action tries to figure out the current PR.

If the event is a pull_request, it's very easy to get the current PR number from the context via ${{ github.event.number }}, but unfortunately this information does not seem to be readily available for a push event. This action sends a request to GitHub to find the PR associated with the current SHA, and returns its number in the number output. number will be an empty string if there is no PR.

Additionnaly, title and body outputs are available as well to get the respective title and body of the PR. If the PR can be resolved, all labels will be present in the output:

  • as label_<name> and set to true

Usage

    steps:
      - uses: actions/checkout@v1
      # Find the PR associated with this push, if there is one.
      - uses: bettermarks/gh-find-current-pr@bettermarks
        id: findPr
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
      # This will echo "Your PR is 7", or be skipped if there is no current PR.
      - run: echo "Your PR is ${PR}"
        if: success() && steps.findPr.outputs.number
        env:
          PR: ${{ steps.findPr.outputs.number }}

About

Github Action for finding the Pull Request (PR) associated with the current SHA.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%