Get branch name by PR
ActionsGet the name of a branch by either running this action in the context of a PR, or supplying a pull request ID
v1
LatestTags
(2)A Github Action that retrieves the branch name from a PR and sets it in the output for other actions to use. It can either accept a specific PR ID/number, or try to take from the current context if none is provided.
- name: Get branch name based on PR ID
uses: andrevalentin/[email protected]
id: pr_data
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-id: 123
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ steps.pr_data.outputs.branch }}
- name: Get branch name based on PR
uses: andrevalentin/[email protected]
id: pr_data
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ steps.pr_data.outputs.branch }}
The scripts and documentation in this project are released under the MIT License
Get branch name by PR is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.