Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/AUTOMATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Repository automation

All code changes go through pull requests. Draft PRs skip expensive CI; mark a PR ready to validate its latest revision. Superseded PR runs cancel. Documentation-only changes skip product checks; no paid runner waits or duplicate main-branch validation.

Prepare a release by opening a PR with the version bump and release notes. A manual merge or an explicit instruction to a local agent to release authorizes publication after all required checks pass. “Prepare a release” stops at the PR. Never bypass checks or automatically merge dependency or release PRs. Repositories without a publishing destination do not need artificial releases.

Routine dependencies are grouped weekly; security updates remain immediate. Production schedules and existing external publishing approval gates remain in force.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: github-actions
directories:
- /
patterns:
- '*'
multi-ecosystem-group: routine
multi-ecosystem-groups:
routine:
schedule:
interval: weekly
day: monday
78 changes: 74 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,65 @@
name: CI

on:
push:
branches: [main]
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
changes:
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
relevant: ${{ steps.paths.outputs.relevant }}
steps:
- id: paths
env:
GH_TOKEN: ${{ github.token }}
EXPECTED_BASE: ${{ github.event.pull_request.base.sha }}
EXPECTED_BASE_REF: ${{ github.event.pull_request.base.ref }}
EXPECTED_HEAD: ${{ github.event.pull_request.head.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
echo 'relevant=true' >> "$GITHUB_OUTPUT"
exit 0
fi
gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" > pr.json
gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files?per_page=100" > files.json
gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" > pr-after.json
python3 - <<'PYTHON'
import json, os, re
pr = json.load(open('pr.json'))
after = json.load(open('pr-after.json'))
files = [f for page in json.load(open('files.json')) for f in page]
complete = 0 < len(files) == pr['changed_files'] < 3000
stable = all(p['head']['sha'] == os.environ['EXPECTED_HEAD']
and p['base']['sha'] == os.environ['EXPECTED_BASE']
and p['base']['ref'] == os.environ['EXPECTED_BASE_REF']
and p['changed_files'] == pr['changed_files'] for p in (pr, after))
docs = re.compile(r'^(docs/|README[^/]*\.md$|CHANGELOG[^/]*\.md$|LICENSE[^/]*$|\.github/AUTOMATION\.md$)')
paths = [path for f in files for path in (f['filename'], f.get('previous_filename', f['filename']))]
relevant = not (complete and stable and all(docs.search(path) for path in paths))
with open(os.environ['GITHUB_OUTPUT'], 'a') as output:
output.write(f'relevant={str(relevant).lower()}\n')
PYTHON

check:
if: ((github.event_name == 'workflow_dispatch' || github.event.pull_request.draft == false)) && needs.changes.outputs.relevant == 'true'
needs: changes
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Manifest is in sync with the repo
run: python3 scripts/build-catalog.py --check
Expand Down Expand Up @@ -47,7 +97,7 @@ jobs:
fi
echo "no SDK imports"

- uses: ludeeus/action-shellcheck@master
- uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca # master
with:
severity: warning
format: gcc
Expand Down Expand Up @@ -94,3 +144,23 @@ jobs:
if find . -path ./.git -prune -o \( -name '*.py' -o -name '*.ts' -o -name '*.swift' \) -not -path './scripts/*' -perm -u+x -print | grep .; then
echo "::error::plugins must ship non-executable"; exit 1
fi

required:
name: Required CI
if: always() && (github.event_name == 'workflow_dispatch' || github.event.pull_request.draft == false)
needs: ["changes", "check"]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- env:
NEEDS: ${{ toJSON(needs) }}
run: |
python3 - <<'PYTHON'
import json, os
jobs = json.loads(os.environ['NEEDS'])
assert jobs['changes']['result'] == 'success', 'Path detection failed'
relevant = jobs.pop('changes')['outputs']['relevant']
assert relevant in ('true', 'false')
expected = 'success' if relevant == 'true' else 'skipped'
assert all(job['result'] == expected for job in jobs.values()), jobs
PYTHON
Loading