Skip to content

Commit 21682dc

Browse files
committed
Use merge_commit_sha when checking out closed pull requests
1 parent 448bba7 commit 21682dc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

action.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@ runs:
1212
- name: Checkout the base branch for the pull request.
1313
uses: actions/checkout@v3
1414

15-
- name: Checkout the merge branch for the pull request.
15+
- name: Checkout the merge branch for the open pull request.
16+
if: github.event.pull_request.state == 'open'
1617
run: |-
1718
git fetch origin +refs/pull/${{ github.event.pull_request.number }}/merge
1819
git checkout FETCH_HEAD
1920
shell: bash
2021

22+
- name: Checkout the merge branch for the closed pull request.
23+
if: github.event.pull_request.state != 'open'
24+
run: |-
25+
git fetch origin ${{ github.event.pull_request.merge_commit_sha }}
26+
git checkout FETCH_HEAD
27+
shell: bash
28+
2129
- name: Setup Python for the action.
2230
id: python-for-action
2331
uses: actions/setup-python@v4

0 commit comments

Comments
 (0)