fix(workflows): harden scorecard and cross-platform reuse #7
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
| name: ci | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: {} | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate: | |
| name: static validators | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Harden runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| agent.api.stepsecurity.io:443 | |
| github.com:443 | |
| api.github.com:443 | |
| pypi.org:443 | |
| files.pythonhosted.org:443 | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: "3.13" | |
| - name: Install validator dependencies | |
| run: python3 -m pip install -r requirements-ci.txt | |
| - name: Run static validators | |
| run: python3 scripts/validate_all.py | |
| actionlint: | |
| permissions: | |
| contents: read | |
| uses: ./.github/workflows/actionlint.yml | |
| zizmor: | |
| permissions: | |
| contents: read | |
| security-events: write | |
| uses: ./.github/workflows/zizmor-sarif.yml | |
| ci-gate: | |
| name: ci-gate | |
| needs: [validate, actionlint, zizmor] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Aggregate required results | |
| env: | |
| VALIDATE_RESULT: ${{ needs.validate.result }} | |
| ACTIONLINT_RESULT: ${{ needs.actionlint.result }} | |
| ZIZMOR_RESULT: ${{ needs.zizmor.result }} | |
| run: | | |
| set -euo pipefail | |
| for r in "$VALIDATE_RESULT" "$ACTIONLINT_RESULT" "$ZIZMOR_RESULT"; do | |
| if [ "$r" != "success" ]; then | |
| echo "required job failed: $r" >&2 | |
| exit 1 | |
| fi | |
| done | |
| echo "ci-gate passed" |