From ec87998864287a00500984e35b6213cbaabe5c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ribeiro=20Vieira?= Date: Sun, 8 Nov 2026 22:20:30 +0100 Subject: [PATCH 1/2] ci: lint GitHub workflows with zizmor and actionlint Add zizmor and actionlint as dev dependencies and pre-commit hooks, and fix what zizmor reports in the root workflows: - Pin actions to exact tags and lock their commits in .github/workflows/actions.lock, generated by gh actions-lock. - Do not persist checkout credentials. - Call same-repository workflows with the $/ syntax. - Wait 7 days before Dependabot proposes a new version. actionlint does not accept the $/ syntax yet, so its hook only runs manually with make lint-actionlint. --- .github/dependabot.yml | 6 +++++ .github/workflows/actions.lock | 46 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 12 ++++++--- .github/workflows/release.yml | 8 +++--- .github/workflows/sbom.yml | 6 +++-- .pre-commit-config.yaml | 16 ++++++++++++ AGENTS.md | 12 +++++++++ pyproject.toml | 2 ++ uv.lock | 29 +++++++++++++++++++++ 9 files changed, 127 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/actions.lock diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c788fcc..40b069e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,13 +5,19 @@ updates: directory: / schedule: interval: weekly + cooldown: + default-days: 7 - package-ecosystem: uv directory: / schedule: interval: weekly + cooldown: + default-days: 7 - package-ecosystem: pre-commit directory: / schedule: interval: weekly + cooldown: + default-days: 7 diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock new file mode 100644 index 0000000..4987678 --- /dev/null +++ b/.github/workflows/actions.lock @@ -0,0 +1,46 @@ +# This file is machine-generated by `gh actions-lock`. +# Do not edit by hand; run `gh actions-lock` to update. +# Docs: https://gh.io/actions-lockfile +version: 'v0.0.3' +workflows: + '.github/workflows/ci.yml': + - 'actions/checkout@v7.0.1' + - 'astral-sh/setup-uv@v7.6.0' + '.github/workflows/release.yml': + - 'actions/attest@v4.2.2' + - 'actions/download-artifact@v8.0.2' + '.github/workflows/sbom.yml': + - 'actions/checkout@v7.0.1' + - 'actions/upload-artifact@v7.0.2' + - 'anchore/sbom-action@v0.24.3' +dependencies: + 'actions/attest@v4.2.2': + ref: 'v4.2.2' + commit: 'sha1-1e69f48acb82d1966a394da916b4c1698aa569d6' + owner_id: 44036562 + repo_id: 760701061 + 'actions/checkout@v7.0.1': + ref: 'v7.0.1' + commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1' + owner_id: 44036562 + repo_id: 197814629 + 'actions/download-artifact@v8.0.2': + ref: 'v8.0.2' + commit: 'sha1-9000827ccba6bdab643e8b6fd33ac0654aef8333' + owner_id: 44036562 + repo_id: 192626254 + 'actions/upload-artifact@v7.0.2': + ref: 'v7.0.2' + commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9' + owner_id: 44036562 + repo_id: 192625955 + 'anchore/sbom-action@v0.24.3': + ref: 'v0.24.3' + commit: 'sha1-66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c' + owner_id: 16208487 + repo_id: 399925381 + 'astral-sh/setup-uv@v7.6.0': + ref: 'v7.6.0' + commit: 'sha1-37802adc94f370d6bfd71619e3f0bf239e1f3b78' + owner_id: 115962839 + repo_id: 846733598 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 620fd73..5d43e15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false - - uses: astral-sh/setup-uv@v7 + - uses: astral-sh/setup-uv@v7.6.0 with: enable-cache: true @@ -41,9 +43,11 @@ jobs: runner: ubuntu-24.04-arm steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false - - uses: astral-sh/setup-uv@v7 + - uses: astral-sh/setup-uv@v7.6.0 with: enable-cache: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f96510..ddd2c3b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,10 +10,10 @@ permissions: jobs: build: - uses: ./.github/workflows/ci.yml + uses: $/.github/workflows/ci.yml sbom: - uses: ./.github/workflows/sbom.yml + uses: $/.github/workflows/sbom.yml release: needs: [build, sbom] @@ -25,13 +25,13 @@ jobs: id-token: write steps: - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@v8.0.2 with: path: dist merge-multiple: true - name: Attest build provenance - uses: actions/attest@v4 + uses: actions/attest@v4.2.2 with: subject-path: dist/* diff --git a/.github/workflows/sbom.yml b/.github/workflows/sbom.yml index 70629b8..3ca3a51 100644 --- a/.github/workflows/sbom.yml +++ b/.github/workflows/sbom.yml @@ -12,7 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false - name: Install syft uses: anchore/sbom-action/download-syft@v0.24.3 @@ -27,7 +29,7 @@ jobs: --source-name="${NAME}" - name: Upload SBOM - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@v7.0.2 with: name: sbom path: dist/*.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1cf262a..042f846 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,3 +50,19 @@ repos: entry: uv run --frozen shfmt -w language: system types: [shell] + + # actionlint does not accept the $/ syntax yet (pywright/template#38). + - id: actionlint + name: actionlint + entry: >- + uv run --frozen actionlint -ignore + 'reusable workflow call "\$/.+" at "uses" is not following the format' + language: system + files: ^\.github/workflows/.*\.ya?ml$ + + - id: zizmor + name: zizmor + entry: uv run --frozen zizmor .github/ + language: system + files: ^\.github/ + pass_filenames: false diff --git a/AGENTS.md b/AGENTS.md index a9c513d..8c08b92 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -156,6 +156,18 @@ build`, the command CI runs. external tool missing locally). CI must run every case with no skips. - **Docker is required**: the `debian` cases fail without it, they do not skip. +## Workflows + +After adding or removing an action in a workflow, update the lockfile next to +it: + +- **Root**: run `gh actions-lock`. +- **Template**: generate a project for each packaging, run `gh actions-lock` + there and copy the result to + `{{cookiecutter.artifact}}/.github/workflows/actions.lock`, keeping the Jinja + blocks for actions used by one packaging only. + `tests/files/test_actions_lock.py` checks the result. + ## Out of scope - Hooks and extensions: tested separately, not through the diff --git a/pyproject.toml b/pyproject.toml index 1f8e6cc..1244a3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ Issues = "https://github.com/pywright/template/issues" [dependency-groups] dev = [ + "actionlint-py>=1.7.12.25", "docker>=7.2.0", "mbake>=1.5.0", "pre-commit>=4.7.0", @@ -47,6 +48,7 @@ dev = [ "shellcheck-py>=0.11.0.1", "shfmt-py>=4.2.0", "types-docker>=7.2.0.20261102", + "zizmor>=1.32.0", ] [tool.ruff] diff --git a/uv.lock b/uv.lock index ee85634..00549f9 100644 --- a/uv.lock +++ b/uv.lock @@ -2,6 +2,12 @@ version = 1 revision = 5 requires-python = ">=3.12" +[[package]] +name = "actionlint-py" +version = "1.7.12.25" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/33/75/36ee89db39bb3620d1e46fe1f6ec77d6000d30ff45345699e51b4c850e83/actionlint_py-1.7.12.25.tar.gz", hash = "sha256:83f83be4cd317c79b15cbb7022787513a6994f00bfb2dd8da02fa4e62b4f640d", size = 12438, upload-time = "2026-09-22T16:24:42.477Z" } + [[package]] name = "annotated-doc" version = "0.0.5" @@ -869,6 +875,7 @@ dependencies = [ [package.dev-dependencies] dev = [ + { name = "actionlint-py" }, { name = "docker" }, { name = "mbake" }, { name = "pre-commit" }, @@ -880,6 +887,7 @@ dev = [ { name = "shellcheck-py" }, { name = "shfmt-py" }, { name = "types-docker" }, + { name = "zizmor" }, ] [package.metadata] @@ -890,6 +898,7 @@ requires-dist = [ [package.metadata.requires-dev] dev = [ + { name = "actionlint-py", specifier = ">=1.7.12.25" }, { name = "docker", specifier = ">=7.2.0" }, { name = "mbake", specifier = ">=1.5.0" }, { name = "pre-commit", specifier = ">=4.7.0" }, @@ -901,6 +910,7 @@ dev = [ { name = "shellcheck-py", specifier = ">=0.11.0.1" }, { name = "shfmt-py", specifier = ">=4.2.0" }, { name = "types-docker", specifier = ">=7.2.0.20261102" }, + { name = "zizmor", specifier = ">=1.32.0" }, ] [[package]] @@ -973,3 +983,22 @@ sdist = { url = "https://files.pythonhosted.org/packages/dc/3f/935cf1757643381fb wheels = [ { url = "https://files.pythonhosted.org/packages/52/5b/799c3e5b8e04d5fa1c9b61a4c1f5079603e747205c7311b92abd30283df5/virtualenv-21.14.7-py3-none-any.whl", hash = "sha256:3769219a308c5d2f093e7729621ad12a6346b5767a7ec4338414e2a0fb0c526b", size = 5487587, upload-time = "2026-10-12T01:27:29.37Z" }, ] + +[[package]] +name = "zizmor" +version = "1.32.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/84/c5/9c9d931f6d4d3e55c14467a579dfea567d1bc15e4bb4a2fc6e5fbf931ca2/zizmor-1.32.0.tar.gz", hash = "sha256:f0b664d394576e08605fe8094e8e992056d74b808f30c0c9ca9ed227001dcf67", size = 604400, upload-time = "2026-11-02T23:31:21.6Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/98/19/e5eeae31466ee7fe7919050bca7993ecade4878801cd2174d05b1c2da166/zizmor-1.32.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:aa4b4e216321dd5cf202cd79fc83296468f0eed79d850cd65ac8187a6bbc5496", size = 9416965, upload-time = "2026-11-02T23:30:59.361Z" }, + { url = "https://files.pythonhosted.org/packages/cd/68/a258299c0fdb3c266c2df0d422da6380df5602c6b0373af3fbe461231290/zizmor-1.32.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:0a999c98015becd9f69919ce01febadfb1c2be9b8ec2ce9ef7eb13ff23ba8eba", size = 8979489, upload-time = "2026-11-02T23:31:01.724Z" }, + { url = "https://files.pythonhosted.org/packages/be/18/8d66db6e98c89f5d647236e282062d8ccc73f7ba759f7ef8dd6204683518/zizmor-1.32.0-py3-none-manylinux_2_24_aarch64.whl", hash = "sha256:0cdd38fca6eb34ceb567548548d706332e3535ea66894b9168c048e03207b68c", size = 9319662, upload-time = "2026-11-02T23:31:03.763Z" }, + { url = "https://files.pythonhosted.org/packages/68/14/8f4750ef28bdb7234abd0c9be5ebc8c328cdcafa84dd8f7082db711bdd31/zizmor-1.32.0-py3-none-manylinux_2_28_armv7l.whl", hash = "sha256:bddcdb0e37d1aa53c9f831c55627a5829d0d552cb0afb4b80fbe16a3a3140366", size = 8884062, upload-time = "2026-11-02T23:31:05.671Z" }, + { url = "https://files.pythonhosted.org/packages/6f/b2/45f4fcb6f428e774750709ecf5320ba6d96393c03b941d9f37a4586f6924/zizmor-1.32.0-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:84a6acb975accc13408786a2bd274b572537ca19c933ebbc13e78f3988562071", size = 9722222, upload-time = "2026-11-02T23:31:07.513Z" }, + { url = "https://files.pythonhosted.org/packages/ac/86/50f103c3a9f705297807c5dced4554b9fd675837f600eaa9582a97988e52/zizmor-1.32.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d34dcfa702875202b4163d90ebb9cc5222f3d1a7d4b72bf796d87b5a15b24194", size = 9335684, upload-time = "2026-11-02T23:31:09.544Z" }, + { url = "https://files.pythonhosted.org/packages/71/9c/a465f96566aefb152c3411f6b30867913b6ae4e7a730242a801b6a1216ff/zizmor-1.32.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:3f404b26791ed06a5ea9eaa0bfd5b973fc5228bac7db8b3c5ec7f0c7ad2ed16d", size = 8846777, upload-time = "2026-11-02T23:31:11.898Z" }, + { url = "https://files.pythonhosted.org/packages/00/ec/aafd81a32c317509de5a3482c3d8c3c165b4c073d0fdf1e0a54671e1ad63/zizmor-1.32.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:dd818f99d833b86cd432d5412d620d936b5df074b33404fff8b67acff55d3259", size = 9819812, upload-time = "2026-11-02T23:31:14.098Z" }, + { url = "https://files.pythonhosted.org/packages/21/aa/535adba18c93ed5739ed1ea3e4742a42a29e26ae2071026eae01d586538c/zizmor-1.32.0-py3-none-win32.whl", hash = "sha256:eaedf57859f026a0a7da2a6b574517b1fe01e256c6875b3319a06ee1cee026a7", size = 8029245, upload-time = "2026-11-02T23:31:15.871Z" }, + { url = "https://files.pythonhosted.org/packages/0f/1f/1ed88cac316f248c7851860bd209ce2a2abf1a2481d887b8a78619dd4a39/zizmor-1.32.0-py3-none-win_amd64.whl", hash = "sha256:9cd1dd7734042f40ca0faa2a31fb4e9033dede620d996af2f903744b8f04fca9", size = 9194896, upload-time = "2026-11-02T23:31:17.425Z" }, + { url = "https://files.pythonhosted.org/packages/ff/74/4629954a4ccfcd3434509b5228f0357f934a16abc455cf1d2a1b4f7346cc/zizmor-1.32.0-py3-none-win_arm64.whl", hash = "sha256:913fd3943bc1358aa6e23b33fe01cc98bf67af23985258b8fbf24eaa2f8728ea", size = 8654150, upload-time = "2026-11-02T23:31:19.812Z" }, +] From 9e71955292980221fecc79a43afc8f4da21898e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ribeiro=20Vieira?= Date: Sun, 8 Nov 2026 22:26:42 +0100 Subject: [PATCH 2/2] template: lint GitHub workflows with zizmor and actionlint Add zizmor and actionlint to generated projects as dev dependencies and pre-commit hooks, and fix what zizmor reports in their workflows: - Pin actions to exact tags and lock their commits in .github/workflows/actions.lock, with setup-uv only for Python packaging. - Do not persist checkout credentials. - Call same-repository workflows with the $/ syntax. - Wait 7 days before Dependabot proposes a new version. actionlint does not accept the $/ syntax yet, so its hook only runs manually with make lint-actionlint. AGENTS.md says to run gh actions-lock after adding or removing an action. Closes #34 --- tests/files/test_actions_lock.py | 49 ++++++++++++++++++ tests/files/test_rendered.py | 1 + .../.github/dependabot.yml | 8 +++ .../.github/workflows/actions.lock | 51 +++++++++++++++++++ .../.github/workflows/ci.yml | 14 +++-- .../.github/workflows/release.yml | 8 +-- .../.github/workflows/sbom.yml | 6 ++- .../.pre-commit-config.yaml | 16 ++++++ {{cookiecutter.artifact}}/AGENTS.md | 2 + {{cookiecutter.artifact}}/pyproject.toml | 2 + 10 files changed, 146 insertions(+), 11 deletions(-) create mode 100644 tests/files/test_actions_lock.py create mode 100644 {{cookiecutter.artifact}}/.github/workflows/actions.lock diff --git a/tests/files/test_actions_lock.py b/tests/files/test_actions_lock.py new file mode 100644 index 0000000..83809ef --- /dev/null +++ b/tests/files/test_actions_lock.py @@ -0,0 +1,49 @@ +import re +from pathlib import Path + +import pytest + +from tests.helpers import Generate + +# `owner/repo[/path]@ref` in a workflow; the lockfile records `owner/repo@ref`. +USES = re.compile(r"uses: ([\w-]+/[\w.-]+)(?:/\S+)?(@\S+)$", re.MULTILINE) +PINNED = re.compile(r"^ '(.+@.+)':$", re.MULTILINE) +SETUP_UV = "astral-sh/setup-uv@" + + +def read_lockfile(project: Path) -> str: + return (project / ".github" / "workflows" / "actions.lock").read_text() + + +@pytest.mark.parametrize("packaging", ["python", "debian-jammy-arm64"]) +def test_whenPackagingIsSet_expectEveryActionLockedOnce( + generate: Generate, packaging: str +) -> None: + project = generate(packaging=packaging) + lockfile = read_lockfile(project) + + used = { + path.name: sorted({repo + ref for repo, ref in USES.findall(path.read_text())}) + for path in sorted((project / ".github" / "workflows").glob("*.yml")) + } + workflows = "".join( + f" '.github/workflows/{name}':\n" + + "".join(f" - '{action}'\n" for action in actions) + for name, actions in used.items() + ) + + assert f"\nworkflows:\n{workflows}dependencies:\n" in lockfile + assert PINNED.findall(lockfile) == sorted(set().union(*used.values())) + + +def test_whenPackagingIsPython_expectSetupUvLocked(generate: Generate) -> None: + lockfile = read_lockfile(generate(packaging="python")) + + assert f" - '{SETUP_UV}" in lockfile + assert f"\n '{SETUP_UV}" in lockfile + + +def test_whenPackagingIsDebian_expectSetupUvNotLocked(generate: Generate) -> None: + lockfile = read_lockfile(generate(packaging="debian-jammy-arm64")) + + assert SETUP_UV not in lockfile diff --git a/tests/files/test_rendered.py b/tests/files/test_rendered.py index 48a8f19..5efb648 100644 --- a/tests/files/test_rendered.py +++ b/tests/files/test_rendered.py @@ -11,6 +11,7 @@ ".editorconfig", "AGENTS.md", ".github/dependabot.yml", + ".github/workflows/actions.lock", ".github/workflows/ci.yml", ".github/workflows/release.yml", ".github/workflows/sbom.yml", diff --git a/{{cookiecutter.artifact}}/.github/dependabot.yml b/{{cookiecutter.artifact}}/.github/dependabot.yml index 458ac04..e1b4bdf 100644 --- a/{{cookiecutter.artifact}}/.github/dependabot.yml +++ b/{{cookiecutter.artifact}}/.github/dependabot.yml @@ -5,20 +5,28 @@ updates: directory: / schedule: interval: weekly + cooldown: + default-days: 7 - package-ecosystem: uv directory: / schedule: interval: weekly + cooldown: + default-days: 7 - package-ecosystem: pre-commit directory: / schedule: interval: weekly + cooldown: + default-days: 7 {%- if cookiecutter.__packaging == 'debian' %} - package-ecosystem: docker directory: /packaging schedule: interval: weekly + cooldown: + default-days: 7 {%- endif %} diff --git a/{{cookiecutter.artifact}}/.github/workflows/actions.lock b/{{cookiecutter.artifact}}/.github/workflows/actions.lock new file mode 100644 index 0000000..3b1612b --- /dev/null +++ b/{{cookiecutter.artifact}}/.github/workflows/actions.lock @@ -0,0 +1,51 @@ +# This file is machine-generated by `gh actions-lock`. +# Do not edit by hand; run `gh actions-lock` to update. +# Docs: https://gh.io/actions-lockfile +version: 'v0.0.3' +workflows: + '.github/workflows/ci.yml': + - 'actions/checkout@v7.0.1' + - 'actions/upload-artifact@v7.0.2' +{%- if cookiecutter.__packaging == 'python' %} + - 'astral-sh/setup-uv@v7.6.0' +{%- endif %} + '.github/workflows/release.yml': + - 'actions/attest@v4.2.2' + - 'actions/download-artifact@v8.0.2' + '.github/workflows/sbom.yml': + - 'actions/checkout@v7.0.1' + - 'actions/upload-artifact@v7.0.2' + - 'anchore/sbom-action@v0.24.3' +dependencies: + 'actions/attest@v4.2.2': + ref: 'v4.2.2' + commit: 'sha1-1e69f48acb82d1966a394da916b4c1698aa569d6' + owner_id: 44036562 + repo_id: 760701061 + 'actions/checkout@v7.0.1': + ref: 'v7.0.1' + commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1' + owner_id: 44036562 + repo_id: 197814629 + 'actions/download-artifact@v8.0.2': + ref: 'v8.0.2' + commit: 'sha1-9000827ccba6bdab643e8b6fd33ac0654aef8333' + owner_id: 44036562 + repo_id: 192626254 + 'actions/upload-artifact@v7.0.2': + ref: 'v7.0.2' + commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9' + owner_id: 44036562 + repo_id: 192625955 + 'anchore/sbom-action@v0.24.3': + ref: 'v0.24.3' + commit: 'sha1-66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c' + owner_id: 16208487 + repo_id: 399925381 +{%- if cookiecutter.__packaging == 'python' %} + 'astral-sh/setup-uv@v7.6.0': + ref: 'v7.6.0' + commit: 'sha1-37802adc94f370d6bfd71619e3f0bf239e1f3b78' + owner_id: 115962839 + repo_id: 846733598 +{%- endif %} diff --git a/{{cookiecutter.artifact}}/.github/workflows/ci.yml b/{{cookiecutter.artifact}}/.github/workflows/ci.yml index 5c6b1a1..c5fb1bb 100644 --- a/{{cookiecutter.artifact}}/.github/workflows/ci.yml +++ b/{{cookiecutter.artifact}}/.github/workflows/ci.yml @@ -16,16 +16,18 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false - - uses: astral-sh/setup-uv@v7 + - uses: astral-sh/setup-uv@v7.6.0 with: enable-cache: true - name: Build distributions run: make build - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@v7.0.2 with: name: dist path: dist/* @@ -34,12 +36,14 @@ jobs: runs-on: {{ 'ubuntu-24.04-arm' if cookiecutter.__arch == 'arm64' else 'ubuntu-24.04' }} steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false - name: Build Debian package run: make build - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@v7.0.2 with: name: deb-{{ cookiecutter.__codename }}-{{ cookiecutter.__arch }} path: | diff --git a/{{cookiecutter.artifact}}/.github/workflows/release.yml b/{{cookiecutter.artifact}}/.github/workflows/release.yml index b2af3f3..e7f269e 100644 --- a/{{cookiecutter.artifact}}/.github/workflows/release.yml +++ b/{{cookiecutter.artifact}}/.github/workflows/release.yml @@ -10,10 +10,10 @@ permissions: jobs: build: - uses: ./.github/workflows/ci.yml + uses: $/.github/workflows/ci.yml sbom: - uses: ./.github/workflows/sbom.yml + uses: $/.github/workflows/sbom.yml release: needs: [build, sbom] @@ -25,13 +25,13 @@ jobs: id-token: write steps: - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@v8.0.2 with: path: dist merge-multiple: true - name: Attest build provenance - uses: actions/attest@v4 + uses: actions/attest@v4.2.2 with: subject-path: dist/* diff --git a/{{cookiecutter.artifact}}/.github/workflows/sbom.yml b/{{cookiecutter.artifact}}/.github/workflows/sbom.yml index 70629b8..3ca3a51 100644 --- a/{{cookiecutter.artifact}}/.github/workflows/sbom.yml +++ b/{{cookiecutter.artifact}}/.github/workflows/sbom.yml @@ -12,7 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false - name: Install syft uses: anchore/sbom-action/download-syft@v0.24.3 @@ -27,7 +29,7 @@ jobs: --source-name="${NAME}" - name: Upload SBOM - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@v7.0.2 with: name: sbom path: dist/*.json diff --git a/{{cookiecutter.artifact}}/.pre-commit-config.yaml b/{{cookiecutter.artifact}}/.pre-commit-config.yaml index 3e8b9e8..88f27dd 100644 --- a/{{cookiecutter.artifact}}/.pre-commit-config.yaml +++ b/{{cookiecutter.artifact}}/.pre-commit-config.yaml @@ -48,3 +48,19 @@ repos: entry: uv run --frozen shfmt -w language: system types: [shell] + + # actionlint does not accept the $/ syntax yet (pywright/template#38). + - id: actionlint + name: actionlint + entry: >- + uv run --frozen actionlint -ignore + 'reusable workflow call "\$/.+" at "uses" is not following the format' + language: system + files: ^\.github/workflows/.*\.ya?ml$ + + - id: zizmor + name: zizmor + entry: uv run --frozen zizmor .github/ + language: system + files: ^\.github/ + pass_filenames: false diff --git a/{{cookiecutter.artifact}}/AGENTS.md b/{{cookiecutter.artifact}}/AGENTS.md index cf0b520..619a540 100644 --- a/{{cookiecutter.artifact}}/AGENTS.md +++ b/{{cookiecutter.artifact}}/AGENTS.md @@ -114,6 +114,8 @@ newer one. - **Changes**: follow existing patterns, and keep changes small and focused. - **Approval**: ask before adding a dependency. - **Generated files**: do not edit them or the lockfile by hand. +- **Actions**: after adding or removing an action in a workflow, run + `gh actions-lock` to update `.github/workflows/actions.lock`. - **Commits**: use Conventional Commits for commit messages. - **This file**: update it in the same change when you change commands, tooling or conventions. diff --git a/{{cookiecutter.artifact}}/pyproject.toml b/{{cookiecutter.artifact}}/pyproject.toml index 5eb2467..1310e47 100644 --- a/{{cookiecutter.artifact}}/pyproject.toml +++ b/{{cookiecutter.artifact}}/pyproject.toml @@ -23,6 +23,7 @@ dependencies = [ [dependency-groups] dev = [ + "actionlint-py>=1.7.12.25", "mbake>=1.5.0", "pre-commit>=4.7.0", "pyrefly>=1.4.0", @@ -31,6 +32,7 @@ dev = [ "ruff>=0.17.3", "shellcheck-py>=0.11.0.1", "shfmt-py>=4.2.0", + "zizmor>=1.32.0", ] {%- if cookiecutter.__packaging == 'debian' %} deb = [