decode_tools / .github /workflows /repo_validate.yml
DecodeMarketing's picture
ci(ai-standards): SHA-pin actions + least-privilege permissions (slice 2b) (#25)
c745b10 unverified
Raw History Blame Contribute Delete
1.4 kB
name: repo_validate
# PR-only. Never fires on push to main — that path is reserved for the HF
# Spaces deploy in main.yml, which must not be perturbed.
#
# Mirrors `python scripts/repo_validate.py` locally:
# - py_compile sweep over every tracked *.py file
# - requirements.txt is parseable as PEP 508 requirements
# - README.md HF Spaces frontmatter has the expected keys
#
# Pairs with the existing gate.yml (ruff lint on changed files). gate.yml
# catches changed-file lint; this workflow catches whole-repo syntactic state.
# Together they cover the regression case where a syntax error reaches main in
# a file the PR did not touch.
on:
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
jobs:
repo_validate:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
# SHA-pinned in slice 2b (supply-chain hardening).
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
# Match runtime.txt so the validator sees the same Python the HF
# Space uses. Keep these in sync.
python-version: "3.12"
- name: Run repo_validate.py
run: python scripts/repo_validate.py