1515name : Build with unit tests 
1616
1717on :
18-   workflow_run :
19-     workflows : 
20-       -  Trigger build 
21-     types : 
22-       -  completed 
18+   push :
19+     branches :  [ develop, release/** ] 
20+   pull_request : 
21+     branches :  [ develop, release/** ] 
22+     types :  [opened, synchronize, reopened, labeled] 
2323
2424jobs :
2525  build :
2626    runs-on : k8s-runner-build 
2727
28-     if : ${{ github.event.workflow_run.conclusion != 'skipped' }} 
28+     #  We allow builds:
29+     #  1) When it's a merge into a branch
30+     #  2) For PRs that are labeled as build and
31+     #   - It's a code change
32+     #   - A build label was just added
33+     #  A bit complex, but prevents builds when other labels are manipulated
34+     if : > 
35+       github.event_name == 'push' 
36+       || (contains(github.event.pull_request.labels.*.name, 'build') 
37+          && (github.event.action != 'labeled' || github.event.label.name == 'build') 
38+          ) 
2939
3040steps :
31-       #  Pinned 1.0.0 version
32-       - uses : haya14busa/action-workflow_run-status@967ed83efa565c257675ed70cfe5231f062ddd94 
3341      - uses : actions/checkout@v3 
3442        with :
3543          ref : ${{ github.event.workflow_run.head_sha }} 
@@ -43,20 +51,10 @@ jobs:
4351name : Build with Maven 
4452        run : mvn clean test -fae -T 2 -B -V -DcloudBuild -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 
4553      - name : Archive build artifacts 
46-         uses : actions/upload-artifact@v3  
54+         uses : actions/upload-artifact@v4  
4755        if : always() 
4856        with :
49-           name : Build debug files 
57+           name : reports-${{ github.run_id }} 
5058          path : | 
5159            **/target/rat.txt 
5260            **/target/surefire-reports/* 
53- name : Surefire Report 
54-         #  Pinned 3.5.2 version
55-         uses : mikepenz/action-junit-report@16a9560bd02f11e7e3bf6b3e2ef6bba6c9d07c32 
56-         if : always() 
57-         with :
58-           report_paths : ' **/target/surefire-reports/TEST-*.xml' 
59-           github_token : ${{ secrets.GITHUB_TOKEN }} 
60-           detailed_summary : true 
61-           commit : ${{ github.event.workflow_run.head_sha }} 
62-           check_name : Test Report 
0 commit comments