From 52fd729ce86578cbcd6b15c1aa705294231e0d36 Mon Sep 17 00:00:00 2001 From: Yurii Serhiichuk Date: Sun, 29 Nov 2026 18:44:38 +0100 Subject: [PATCH 1/2] chore(ci): pin latest GitHub Actions by SHA and migrate to ubuntu-26.04 Update all GitHub Actions in CI and PyPI release workflows to their latest releases pinned by full 40-character commit SHA, migrate Ubuntu runners to ubuntu-26.04, and apply least-privilege permissions and persist-credentials: false on checkout steps. Signed-off-by: Yurii Serhiichuk --- .github/workflows/main.yml | 19 +++++++++++++------ .github/workflows/pypi-release.yml | 30 +++++++++++++++++++----------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 274a232e..37fbbf04 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,13 +2,18 @@ name: CI on: [push, pull_request] +permissions: + contents: read + jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-26.04 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@v8.1.0 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 with: enable-cache: true cache-dependency-glob: "uv.lock" @@ -23,12 +28,14 @@ jobs: strategy: matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-26.04, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@v8.1.0 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 with: enable-cache: true cache-dependency-glob: "uv.lock" diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index 62dda2de..93c32d58 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -7,16 +7,20 @@ on: - main - 'tag/v**' +permissions: + contents: read + jobs: build_dist: name: Build source distribution - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 + persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@v8.1.0 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.12 - name: Install the project @@ -25,7 +29,7 @@ jobs: - name: Build SDist and wheel run: uv build - - uses: actions/upload-artifact@v7.0.1 + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: artifact path: dist/* @@ -33,15 +37,16 @@ jobs: - name: Check metadata run: uvx twine check dist/* publish: - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 if: github.event_name == 'push' needs: [ build_dist ] outputs: release_needed: ${{ steps.release_check.outputs.release_needed }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 + persist-credentials: false - name: Check release tag id: release_check run: | @@ -51,31 +56,34 @@ jobs: else echo "release_needed=true" >> "$GITHUB_OUTPUT" fi - - uses: actions/download-artifact@v8.0.1 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 if: steps.release_check.outputs.release_needed == 'true' with: name: artifact path: dist - name: Publish if: steps.release_check.outputs.release_needed == 'true' - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: user: __token__ password: ${{ secrets.pypi_password }} tag: - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 needs: [ publish ] if: needs.publish.outputs.release_needed == 'true' + permissions: + contents: write steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 + persist-credentials: false - name: Extract version id: version run: | echo "version=$(grep -oP '__version__ = \"\K[^\"]+' src/cloudevents/__init__.py)" >> $GITHUB_OUTPUT - name: Create and push tag - uses: pxpm/github-tag-action@1.0.1 + uses: pxpm/github-tag-action@07a0f099a1db2ef2c50367665450b9f6ef3b6e9d # 1.0.1 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" tag: ${{ steps.version.outputs.version }} From 7e7d743e594539d2c47efd571ad02c77b272791e Mon Sep 17 00:00:00 2001 From: Yurii Serhiichuk Date: Sun, 29 Nov 2026 18:58:20 +0100 Subject: [PATCH 2/2] chore(ci): keep test matrix on ubuntu-latest Signed-off-by: Yurii Serhiichuk --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 37fbbf04..443af62d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - os: [ubuntu-26.04, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1