Skip to content

Commit 65096d7

Browse files
committed
checkout GitHub pull request branch
1 parent 057957a commit 65096d7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout repository
17+
if: github.event_name != 'pull_request'
1718
uses: actions/checkout@v4
1819

20+
- name: Checkout PR branch
21+
if: github.event_name == 'pull_request'
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.pull_request.head.ref }}
25+
1926
- name: Setup Node.js
2027
uses: actions/setup-node@v4
2128
with:
@@ -34,17 +41,17 @@ jobs:
3441

3542
- name: Check uncommitted indices
3643
id: uncommitted_indices
44+
if: github.event_name == 'pull_request'
3745
run: |
3846
echo "has_changes=$([ -n "$(git diff --name-only HEAD "**/index.ts")" ] && echo "true" || echo "false")" >> $GITHUB_OUTPUT
3947
4048
- name: Commit indices
41-
if: steps.uncommitted_indices.outputs.has_changes == 'true'
49+
if: github.event_name == 'pull_request' && steps.uncommitted_indices.outputs.has_changes == 'true'
4250
run: |
4351
echo "${{ secrets.BOT_PGP_KEY }}" | gpg --import --batch
4452
git config --global user.signingkey "[email protected]"
4553
git config --global user.name "Cloudnode [bot]"
4654
git config --global user.email "[email protected]"
47-
git checkout "${GITHUB_REF#refs/heads/}"
4855
git add "**/index.ts"
4956
git commit -S -m "chore: update indices"
5057
git push

0 commit comments

Comments
 (0)