Enhance papers #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================ | |
| # .github/workflows/ci-hygiene.yml (Continuous Integration) | |
| # ============================================================ | |
| # VARIANT: hygiene-ci | |
| # SOURCE: https://github.com/denisecase/templates | |
| # | |
| # WHY-FILE: Minimal checks for repositories where hygiene is the primary gate. | |
| # REQ: Any check that can be run locally MUST be available locally via pre-commit. | |
| # REQ: CI MUST NOT introduce arbitrary rules that are not reproducible locally. | |
| # OBS: CI does not introduce additional style rules beyond repo configuration. | |
| name: CI Hygiene | |
| # WHY: Validate repo contents on pushes to main branch and pull requests. | |
| on: | |
| push: | |
| branches: [main] # WHY: Run when pushing to main branch. | |
| pull_request: | |
| branches: [main] # WHY: Run on pull requests targeting main branch. | |
| workflow_dispatch: # WHY: Allow manual triggering from Actions tab. | |
| permissions: # WHY: Use least privileges required. | |
| contents: read | |
| env: | |
| PYTHONUNBUFFERED: "1" # WHY: Real-time logging. | |
| PYTHONIOENCODING: "utf-8" # WHY: Ensure UTF-8 encoding for international characters. | |
| jobs: | |
| ci: | |
| name: Repository checks (pre-commit) | |
| runs-on: ubuntu-latest # WHY: Linux environment matches most production deployments | |
| timeout-minutes: 10 # WHY: Prevent hanging jobs. If over, it is likely stuck. | |
| steps: | |
| # ============================================================ | |
| # ASSEMBLE: Get code and set up environment | |
| # ============================================================ | |
| - name: 1) Checkout repository code | |
| # WHY: Needed to access files for checks. | |
| uses: actions/checkout@v6 | |
| - name: 2) Run pre-commit (all files) | |
| # WHY: Single source of truth for locally runnable quality gates. | |
| # OBS: Fails if hooks would modify files; does not commit changes. | |
| id: precommit # WHY: Identify step for conditional follow-up. | |
| uses: pre-commit/[email protected] | |
| with: | |
| extra_args: --all-files | |
| - name: 2f) If pre-commit failed, run it locally | |
| if: failure() | |
| run: | | |
| echo "## Pre-commit failed" >> "$GITHUB_STEP_SUMMARY" | |
| echo "Please run pre-commit locally and commit the resulting changes." >> "$GITHUB_STEP_SUMMARY" |