From a8995f40260290c067fa4459b088fbf7d75a9310 Mon Sep 17 00:00:00 2001 From: Edoardo Rosa <6991986+notdodo@users.noreply.github.com> Date: Sun, 15 Nov 2026 10:31:32 +0100 Subject: [PATCH] ci: inline reusable workflows for public repository access Co-Authored-By: Claude Opus 5.5 --- .github/workflows/clean-branch-cache.yml | 23 +++++++- .github/workflows/python-ci.yml | 72 ++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 6 deletions(-) diff --git a/.github/workflows/clean-branch-cache.yml b/.github/workflows/clean-branch-cache.yml index acdc2c2..638f10e 100644 --- a/.github/workflows/clean-branch-cache.yml +++ b/.github/workflows/clean-branch-cache.yml @@ -5,9 +5,30 @@ on: types: - closed +permissions: {} + jobs: cleanup: + name: Cleanup caches for a merged branch if: github.event.pull_request.merged == true + runs-on: ubuntu-latest permissions: actions: write - uses: DigintLab/github/.github/workflows/clean-branch-cache.yml@cleanup-v0 + steps: + - name: Cleanup + # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#managing-caches + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge + run: | + echo "Fetching list of cache keys" + cache_ids=$(gh cache list --ref "${BRANCH}" --limit 100 --json id --jq '.[].id') + + # Do not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cache_id in $cache_ids; do + gh cache delete "$cache_id" + done + echo "Done" diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 7de78fc..1c63251 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -12,21 +12,83 @@ on: - pyproject.toml - uv.lock +permissions: {} + jobs: python-ci: + name: Python ${{ matrix.python }} + runs-on: ubuntu-latest permissions: contents: read strategy: fail-fast: false matrix: python: ['3.13', '3.14'] - uses: DigintLab/github/.github/workflows/python-ci.yml@e5faa44f33f1f621f43ab05f575c6a1f7a2872d8 # python-ci-v0.0.23 - with: - python-version: ${{ matrix.python }} + env: + UV_LOCKED: '1' + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + with: + python-version: ${{ matrix.python }} + enable-cache: true + cache-suffix: python-${{ matrix.python }} + - name: Install Task + uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0 + with: + repo-token: ${{ github.token }} + - name: Install dependencies + run: task install + - name: Format, lint, and type checks + run: task check + - name: Tests + run: task test + - name: Build + run: uv build infra-scan: + name: Scan with KICS + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: KICS scan + uses: Checkmarx/kics-github-action@4a16c2130b02104dc2624c133d5224080e7cc49b # v2.2.1 + with: + path: . + output_path: kics_results.sarif + output_formats: sarif + fail_on: high,medium + token: ${{ github.token }} + enable_comments: true + enable_annotations: true + enable_jobs_summary: true + comments_with_queries: true + + actions-scan: + name: GitHub Actions security analysis + runs-on: ubuntu-latest permissions: contents: read pull-requests: write - security-events: write - uses: DigintLab/github/.github/workflows/infra-security-scan.yml@e5faa44f33f1f621f43ab05f575c6a1f7a2872d8 # infra-scan-v0.0.24 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: reviewdog/action-actionlint@ae857e78c1b42b3d0a49637181b09d3d56d402b4 # v1.84.1 + continue-on-error: true + with: + fail_level: any + filter_mode: nofilter + tool_name: actionlint + - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + with: + enable-cache: false + - name: Run zizmor + run: uvx zizmor@1.32.0 --offline --format github .