Przeglądaj źródła

Mark scheduled runs with nothing to build as cancelled instead of successful (#705)

* Mark scheduled runs with nothing to build as cancelled instead of successful

* update testflight.md, remove alive references, update loopdocs links

---------

Co-authored-by: marionbarker <marionbarker@earthlink.net>
Jonas Björkert 1 tydzień temu
rodzic
commit
36fe25b389
2 zmienionych plików z 44 dodań i 32 usunięć
  1. 24 0
      .github/workflows/build_LoopFollow.yml
  2. 20 32
      fastlane/testflight.md

+ 24 - 0
.github/workflows/build_LoopFollow.yml

@@ -148,6 +148,30 @@ jobs:
             echo "is_second_instance=false" >> "$GITHUB_OUTPUT"
           fi
 
+  # When a scheduled run finds nothing new to build, cancel the run so it shows
+  # as "cancelled" instead of "success" — a green check should always mean a
+  # new build was made.
+  cancel_when_no_build:
+    needs: check_status
+    name: Cancel run when there is nothing to build
+    runs-on: ubuntu-latest
+    permissions:
+      actions: write
+    if: |
+      github.event_name == 'schedule' &&
+        !(vars.SCHEDULED_BUILD != 'false' && needs.check_status.outputs.IS_SECOND_IN_MONTH == 'true') &&
+        !(vars.SCHEDULED_SYNC != 'false' && needs.check_status.outputs.NEW_COMMITS == 'true')
+    steps:
+      - name: Cancel the run
+        env:
+          GH_TOKEN: ${{ github.token }}
+        run: |
+          echo "Repository is up to date and no monthly build is due — cancelling this run so it is not reported as a successful build." >> "$GITHUB_STEP_SUMMARY"
+          gh run cancel ${{ github.run_id }} --repo ${{ github.repository }}
+          # Keep the job alive until the cancellation lands, so the run ends as
+          # "cancelled" rather than completing successfully first.
+          sleep 300
+
   # Checks if Distribution certificate is present and valid, optionally nukes and
   # creates new certs if the repository variable ENABLE_NUKE_CERTS == 'true'
   # only run if a build is planned

Plik diff jest za duży
+ 20 - 32
fastlane/testflight.md