GitHub Actions Hygiene
- Keep one workflow definition for the merge gate;
push,pull_requestandworkflow_dispatchshare the same jobs - Always include
workflow_dispatchso the same pipeline can run from the Actions web UI - Do not copy-paste install, lint or test steps into YAML; after mise, call
task ci:... - Pin third-party actions by commit SHA, not a moving major tag
- Give
GITHUB_TOKENthe least privilege the job needs - Do not
continue-on-erroron the merge gate, and do not echo secrets - Optional
workflow_dispatchinputs only when they change real behaviour; do not add unused inputs
Good:
on: push: branches: [main] pull_request: workflow_dispatch:jobs: ci: steps: - uses: actions/checkout@<sha> - run: mise install - run: task ciBad:
on: push: branches: [ci-hidden]jobs: ci: steps: - run: pip install -r requirements.txt - run: pytest continue-on-error: true