Skip to content

Commit c7183f1

Browse files
budaidevadamsaghy
authored andcommitted
FINERACT-2081: breaking api change test merge base instead of develop to prevent false flags
1 parent ef00f27 commit c7183f1

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

.github/workflows/verify-api-backward-compatibility.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,32 @@ jobs:
2323
fetch-depth: 0
2424
path: baseline
2525

26+
- name: Checkout PR branch
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v5
28+
with:
29+
repository: ${{ github.event.pull_request.head.repo.full_name }}
30+
ref: ${{ github.event.pull_request.head.sha }}
31+
fetch-depth: 0
32+
path: current
33+
34+
- name: Compute merge-base commit
35+
id: merge-base
36+
run: |
37+
cd baseline
38+
# For fork PRs, fetch PR head from the local current/ checkout
39+
git fetch "${GITHUB_WORKSPACE}/current" HEAD --no-tags 2>/dev/null || true
40+
MERGE_BASE=$(git merge-base ${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.sha }})
41+
echo "Merge-base commit: ${MERGE_BASE}"
42+
echo "sha=${MERGE_BASE}" >> "$GITHUB_OUTPUT"
43+
BASE_HEAD=$(git rev-parse ${{ github.event.pull_request.base.ref }})
44+
if [ "${MERGE_BASE}" != "${BASE_HEAD}" ]; then
45+
echo "::notice::PR is not rebased on latest ${{ github.event.pull_request.base.ref }}. Using merge-base ${MERGE_BASE} as baseline (branch HEAD: ${BASE_HEAD})."
46+
fi
47+
48+
- name: Reset baseline to merge-base
49+
working-directory: baseline
50+
run: git checkout ${{ steps.merge-base.outputs.sha }}
51+
2652
- name: Set up JDK 21
2753
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
2854
with:
@@ -33,14 +59,6 @@ jobs:
3359
working-directory: baseline
3460
run: ./gradlew :fineract-provider:resolve --no-daemon
3561

36-
- name: Checkout PR branch
37-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v5
38-
with:
39-
repository: ${{ github.event.pull_request.head.repo.full_name }}
40-
ref: ${{ github.event.pull_request.head.sha }}
41-
fetch-depth: 0
42-
path: current
43-
4462
- name: Generate PR spec
4563
working-directory: current
4664
run: ./gradlew :fineract-provider:resolve --no-daemon

0 commit comments

Comments
 (0)