A clone of this repo pushed to a new repository -- a private mirror, an internal re-host -- inherits .github/workflows together with its cron. The full platform matrix then runs on that owner's Actions bill, nightly and unattended. Forks are only partially covered: GitHub disables scheduled workflows there, but nothing covers a fresh repository, and nothing warns the owner. This mirrors OpenIPC/firmware#2255, where the same inherited cron was measured at 97 jobs and 2,146 billed minutes from a single unattended night, and never converged: publishing failed on the mirror, so the sha skip-gate could never engage and the matrix rebuilt in full every night. The rule: unattended runs happen only on the canonical repo. Anywhere else a workflow runs only if someone explicitly asked for it (workflow_dispatch), or if it is both free and attended (pull_request on a public repo). This is deliberately stricter than gating purely on cost -- a public re-host's minutes are free and its cron is still skipped, because a re-host quietly publishing nightly releases under its own name is a worse outcome than wasted minutes. master carries the guard on preflight; buildroot needs it and inherits the skip. manifest gates its cron-originated workflow_run path the same way, because a nightly whose jobs all skipped still completes and fires workflow_run. cleanup carries it on its weekly cron. build-one is dispatch-only and needs nothing. The pull_request clause is unreachable here today -- no workflow in this repo has a pull_request trigger -- and is kept on purpose: it is the clause that lets contributor PRs run, and omitting it would mean adding a pull_request trigger later silently skips CI on every fork. That over-block was the first thing reviewers caught upstream. Upstream impact is none: on OpenIPC/builder the first disjunct is true, so every added condition is a tautology and each job's if reduces to what it was before. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
name: cleanup
|
|
on:
|
|
schedule:
|
|
- cron: '0 6 * * 1' # Mondays 06:00 UTC (offset by +1h from firmware's cleanup)
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
actions: write
|
|
|
|
concurrency:
|
|
group: gh-pages-manifest
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
prune:
|
|
name: Prune old nightly releases
|
|
# Canonical repo only on the weekly cron -- see master.yml's preflight.
|
|
# Dispatch runs are unaffected.
|
|
if: github.event_name != 'schedule' || github.repository == 'OpenIPC/builder'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Delete releases beyond the 90 newest
|
|
id: prune
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
to_delete=$(gh release list --limit 200 --json tagName,createdAt \
|
|
| jq -r '[ .[] | select(.tagName | test("^nightly-[0-9]{8}-[0-9a-f]{7}$")) ]
|
|
| sort_by(.createdAt) | reverse | .[90:] | .[].tagName')
|
|
|
|
if [ -z "$to_delete" ]; then
|
|
echo "Nothing to delete; <=90 dated nightlies present."
|
|
echo "pruned=false" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
|
|
echo "$to_delete" | while read -r tag; do
|
|
[ -z "$tag" ] && continue
|
|
echo "Deleting $tag"
|
|
gh release delete "$tag" --cleanup-tag --yes
|
|
done
|
|
echo "pruned=true" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Refresh manifest
|
|
if: steps.prune.outputs.pruned == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: gh workflow run manifest.yml
|