Skip to content

Commit 91104e9

Browse files
committed
fix: update PR branch handling to fetch latest changes from remote
1 parent 55a9bd4 commit 91104e9

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/pr-preprod-tests.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,23 @@ jobs:
2424
run: |
2525
cd /home/integration/git/cardano-rosetta-java
2626
27+
# Fetch latest from remote
28+
git fetch origin
29+
2730
# Clean up any existing PR branch and switch to main first
2831
git checkout main || git checkout develop
29-
git branch -D pr-${{ github.event.pull_request.number }} 2>/dev/null || true
32+
git pull origin main || git pull origin develop
3033
31-
# Fetch and checkout the PR
32-
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
33-
git checkout pr-${{ github.event.pull_request.number }}
34+
# Checkout appropriate branch based on trigger type
35+
if [ "${{ github.event_name }}" = "pull_request" ]; then
36+
git branch -D pr-${{ github.event.pull_request.number }} 2>/dev/null || true
37+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
38+
git checkout pr-${{ github.event.pull_request.number }}
39+
else
40+
# workflow_dispatch: checkout the selected branch
41+
git checkout ${{ github.ref_name }}
42+
git pull origin ${{ github.ref_name }}
43+
fi
3444
3545
- name: Stop current services
3646
run: |

0 commit comments

Comments
 (0)