Skip to content

Commit 5703eb8

Browse files
authored
set Checkout Pull Request step (#9)
* set `Checkout Pull Request step` ref: actions/checkout#331 (comment) * fix condition * fix
1 parent c33d203 commit 5703eb8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.github/workflows/test-action.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,21 @@ jobs:
1313
runs-on: ubuntu-latest
1414
permissions:
1515
pull-requests: write
16-
if: github.event.issue.pull_request
16+
if: github.event_name != 'issue_comment' || github.event.issue.pull_request
1717
steps:
18-
- name: Get PR branch
19-
uses: xt0rted/pull-request-comment-branch@v1
20-
id: comment-branch
21-
2218
- name: Checkout
2319
id: checkout
2420
uses: actions/checkout@v4
25-
with:
26-
ref: ${{ steps.comment-branch.outputs.head_ref }}
21+
22+
- name: Checkout Pull Request
23+
if: github.event.issue.pull_request
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
run: |
27+
PR_URL="${{ github.event.issue.pull_request.url }}"
28+
PR_NUM=${PR_URL##*/}
29+
echo "Checking out from PR #$PR_NUM based on URL: $PR_URL"
30+
hub pr checkout $PR_NUM
2731
2832
- name: Test Local Action
2933
id: test-action

0 commit comments

Comments
 (0)