Skip to content

Commit

Permalink
feat(misc): checkout branch of that PR if PR is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Mar 1, 2024
1 parent 72e587f commit 08f41a1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ jobs:
with:
version: 8

- name: Fetch PR details (if PR number provided)
if: github.event.inputs.pr
id: pr_details
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.inputs.pr }},
});
return pr.data.head.ref;
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ steps.pr_details.outputs.result || 'master' }} # Default to master branch if PR number not provided

- name: Setup node
uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
Expand Down

0 comments on commit 08f41a1

Please sign in to comment.