From 537531a9c8176984f81759a74afea86a5ccba056 Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Sun, 1 Nov 2026 22:40:56 -0800 Subject: [PATCH 1/2] Skip the Swift build unless a release is due AIRAC cycles take effect on Thursdays and this pipeline cuts the release the day before, so it only needs to run on Wednesdays and Thursdays (Thursday never has a release due, because the next cycle is then 28 days out). Every run used to spend about nine minutes on toolchain setup and a release build before deciding there was nothing to publish. A probe job on a bare runner now makes that decision first: a release is due when tomorrow is an AIRAC effective date (28-day steps from SwiftNASR's Cycle.datum, 2020-12-03, which is the same condition as the generator's 'tomorrow is not before the next cycle') and the release tagged with that date does not exist. Manual dispatches with a cycle always proceed. The publish job runs only when the probe says a release is due, and keeps its own check. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 50 ++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2159c87..70bdf72 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,10 +2,11 @@ name: Publish Nav Data on: schedule: - # Daily at 09:00 UTC, but only acts the day before each AIRAC cycle takes - # effect: it cuts that cycle's release then, so its continuously-updated - # OurAirports data is fresh. Every other day is a no-op. Idempotent. - - cron: "0 9 * * *" + # Wednesdays and Thursdays at 09:00 UTC, but only acts the day before each + # AIRAC cycle takes effect (always a Wednesday, since cycles take effect on + # Thursdays): it cuts that cycle's release then, so its continuously-updated + # OurAirports data is fresh. Every other run is a no-op. Idempotent. + - cron: "0 9 * * 3,4" workflow_dispatch: inputs: cycle: @@ -21,8 +22,49 @@ concurrency: cancel-in-progress: false jobs: + probe: + name: Check whether a release is due + runs-on: ubuntu-latest + outputs: + due: ${{ steps.due.outputs.due }} + steps: + - name: Check whether a release is due + id: due + env: + GH_TOKEN: ${{ github.token }} + # There is no checkout here for gh to read the repository from. + GH_REPO: ${{ github.repository }} + DISPATCH_CYCLE: ${{ github.event.inputs.cycle }} + run: | + set -euo pipefail + + # A release is due when tomorrow is the effective date of an AIRAC + # cycle, 28 days apart from SwiftNASR's Cycle.datum, and that + # cycle's release does not exist yet. An explicit dispatch request + # always proceeds. + airac_datum=2020-12-03 + tomorrow="$(date -u -d tomorrow +%F)" + days_since_datum=$(( ($(date -u -d "$tomorrow" +%s) - $(date -u -d "$airac_datum" +%s)) / 86400 )) + + if [ -n "$DISPATCH_CYCLE" ]; then + echo "Manual request for cycle $DISPATCH_CYCLE." + due=true + elif (( days_since_datum < 0 || days_since_datum % 28 != 0 )); then + echo "Tomorrow ($tomorrow) is not an AIRAC effective date; nothing to do." + due=false + elif gh release view "$tomorrow" >/dev/null 2>&1; then + echo "Release $tomorrow already exists; nothing to do." + due=false + else + echo "Cycle $tomorrow takes effect tomorrow and has no release." + due=true + fi + echo "due=$due" >> "$GITHUB_OUTPUT" + publish: name: Generate and publish + needs: probe + if: needs.probe.outputs.due == 'true' # Runs on the ubuntu-latest host (not a container) so the preinstalled `gh` CLI is # available for publishing releases. runs-on: ubuntu-latest From 36a266c782be4e94a199193e97495bfa5e4b60f6 Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Sun, 1 Nov 2026 22:41:30 -0800 Subject: [PATCH 2/2] Run the release workflow on Wednesdays only The release is cut the day before an AIRAC cycle takes effect, which is always a Wednesday. A Thursday run never has anything to publish, because the next cycle is then 28 days out. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70bdf72..214ee32 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,11 +2,11 @@ name: Publish Nav Data on: schedule: - # Wednesdays and Thursdays at 09:00 UTC, but only acts the day before each - # AIRAC cycle takes effect (always a Wednesday, since cycles take effect on - # Thursdays): it cuts that cycle's release then, so its continuously-updated + # Wednesdays at 09:00 UTC, but only acts the day before each AIRAC cycle + # takes effect (always a Wednesday, since cycles take effect on Thursdays): + # it cuts that cycle's release then, so its continuously-updated # OurAirports data is fresh. Every other run is a no-op. Idempotent. - - cron: "0 9 * * 3,4" + - cron: "0 9 * * 3" workflow_dispatch: inputs: cycle: