1616 HEAD_REF : ${{ github.head_ref }}
1717 REF_NAME : ${{ github.ref_name }}
1818 HEAD_SHA : ${{ github.event.pull_request.head.sha }}
19+ USE_FORMATTED_CODE : false
1920jobs :
2021 check-permissions :
2122 uses : ./.github/workflows/check-permissions.yml
2829 timeout-minutes : 120
2930 outputs :
3031 changes_committed : ${{ steps.commit-changes.outputs.changes_committed }}
32+ new_sha : ${{ steps.commit-changes.outputs.new_sha }}
3133
3234 steps :
3335 - name : Checkout code
@@ -91,10 +93,14 @@ jobs:
9193 git add -u
9294 git commit -m "chore: apply code formatting with spotless"
9395
96+ # Get the new commit SHA
97+ NEW_SHA=$(git rev-parse HEAD)
98+ echo "new_sha=$NEW_SHA" >> $GITHUB_OUTPUT
99+
94100 git push
95101
96102 echo "changes_committed=true" >> $GITHUB_OUTPUT
97- echo "✅ Formatting changes committed and pushed" >> $GITHUB_STEP_SUMMARY
103+ echo "✅ Formatting changes committed and pushed. Continuing with validation on formatted code. " >> $GITHUB_STEP_SUMMARY
98104
99105 - name : Generate diff for artifact
100106 if : steps.formatter.outputs.modified != '0'
@@ -150,12 +156,6 @@ jobs:
150156 comment_id: ${{ steps.find-comment.outputs.comment-id }}
151157 })
152158
153- - name : Stop workflow if changes were committed
154- if : steps.commit-changes.outputs.changes_committed == 'true'
155- run : |
156- echo "::notice::Formatting changes were committed. Stopping workflow. Tests will run on next push."
157- exit 1
158-
159159 build :
160160 needs : [check-permissions, formatter]
161161 if : always() && needs.check-permissions.result == 'success' && (needs.formatter.result == 'success' || needs.formatter.result == 'skipped')
@@ -173,7 +173,7 @@ jobs:
173173 | tee -a $GITHUB_STEP_SUMMARY && exit 1 || exit 0
174174 - uses : actions/checkout@v4
175175 with :
176- ref : ${{env.HEAD_SHA}}
176+ ref : ${{ needs.formatter.outputs.new_sha || env.HEAD_SHA }}
177177 - uses : actions/setup-node@v4
178178 with :
179179 node-version : ' 24.9.0'
@@ -212,7 +212,7 @@ jobs:
212212 name : saved-workspace
213213 path : workspace.tar
214214 unit-tests :
215- needs : build
215+ needs : [ build, formatter]
216216 timeout-minutes : 30
217217 strategy :
218218 fail-fast : false
@@ -221,7 +221,7 @@ jobs:
221221 steps :
222222 - uses : actions/checkout@v4
223223 with :
224- ref : ${{env.HEAD_SHA}}
224+ ref : ${{ needs.formatter.outputs.new_sha || env.HEAD_SHA }}
225225 - name : Set up JDK 21
226226 uses : actions/setup-java@v4
227227 with :
@@ -278,7 +278,7 @@ jobs:
278278 name : tests-output-unit-${{ matrix.current }}
279279 path : tests-report-*.tgz
280280 it-tests :
281- needs : build
281+ needs : [ build, formatter]
282282 timeout-minutes : 30
283283 strategy :
284284 fail-fast : false
@@ -287,7 +287,7 @@ jobs:
287287 steps :
288288 - uses : actions/checkout@v4
289289 with :
290- ref : ${{env.HEAD_SHA}}
290+ ref : ${{ needs.formatter.outputs.new_sha || env.HEAD_SHA }}
291291 - uses : actions/setup-node@v4
292292 with :
293293 node-version : ' 24.9.0'
@@ -367,7 +367,7 @@ jobs:
367367 checks : write
368368 pull-requests : write
369369 if : ${{ failure() || success() }}
370- needs : [unit-tests, it-tests]
370+ needs : [unit-tests, it-tests, formatter ]
371371 runs-on : ubuntu-24.04
372372 steps :
373373 - name : Merge Artifacts
@@ -377,7 +377,7 @@ jobs:
377377 pattern : tests-output-*
378378 - uses : actions/checkout@v4
379379 with :
380- ref : ${{env.HEAD_SHA}}
380+ ref : ${{ needs.formatter.outputs.new_sha || env.HEAD_SHA }}
381381 - uses : actions/download-artifact@v4
382382 with :
383383 name : tests-output
0 commit comments