From 83046b5bbcb50390073105fa36304da62c714c14 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:08:56 +0300 Subject: [PATCH 01/11] CI: compare complete pull request changes The incremental comparison falls back to the final commit when a pull request is first opened. This can hide an earlier container change and make the result depend on a previously published pull request image. Use the action defaults: pull requests are compared with their base branch, while pushes are compared with the previous remote head. --- .github/workflows/meta.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 873a0b1f..e1635115 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -34,7 +34,7 @@ jobs: - uses: actions/checkout@v4 with: - # fetch full history to be able to gather changed files in all new commits + # Compare pull requests with their base and pushes with their previous head. fetch-depth: 0 - uses: tj-actions/changed-files@v45 @@ -53,8 +53,6 @@ jobs: - 'partitions_willow.csv' - 'sdkconfig.defaults' - 'spiffs/**' - since_last_remote_commit: true - - name: extract metadata id: metadata uses: docker/metadata-action@v5 From 00f7e7d1001de619e03b2c3c3f81c8e6271724fd Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:09:56 +0300 Subject: [PATCH 02/11] CI: treat utils changes as firmware changes utils.sh is not copied into the Docker image, so changing the script cannot alter the container. It can alter firmware setup, compilation, and packaging, however. Move it to the firmware input group to avoid an unnecessary container build while still validating the resulting firmware. --- .github/workflows/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index e1635115..0842f90f 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -46,13 +46,13 @@ jobs: - '.github/workflows/build-container.yml' - 'Dockerfile' - 'container.gitconfig' - - 'utils.sh' image: - 'CMakeLists.txt' - 'main/**' - 'partitions_willow.csv' - 'sdkconfig.defaults' - 'spiffs/**' + - 'utils.sh' - name: extract metadata id: metadata uses: docker/metadata-action@v5 From d25bdef6efa167ef77b10e2778560a87c6dfb764 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:10:41 +0300 Subject: [PATCH 03/11] CI: build firmware for new input files The firmware allowlist must be updated whenever a new source tree, build manifest, binding, asset, or workflow is added. Missing an entry silently skips the build. Build for every changed file by default and exclude only documentation, Home Assistant tooling, and miscellaneous developer tools. Container changes still take the ordered container-and-firmware path. --- .github/workflows/meta.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 0842f90f..40ee9691 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -47,12 +47,10 @@ jobs: - 'Dockerfile' - 'container.gitconfig' image: - - 'CMakeLists.txt' - - 'main/**' - - 'partitions_willow.csv' - - 'sdkconfig.defaults' - - 'spiffs/**' - - 'utils.sh' + - '**' + - '!**/*.md' + - '!ha/**' + - '!misc/**' - name: extract metadata id: metadata uses: docker/metadata-action@v5 From 805cd3d4ea07465c2322b64f52be7b8bf1d5c215 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:13:36 +0300 Subject: [PATCH 04/11] CI: select the base branch container The image-existence action does not define the result output consumed by the meta workflow. The value is always empty, so source-only builds use main even when the matching branch image exists. A complete pull request comparison no longer needs mutable PR images. Select the target branch image instead, using a manifest lookup to fall back to main when a release branch has no independent container yet. --- .github/workflows/meta.yml | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 40ee9691..e0c17fe4 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -19,9 +19,8 @@ jobs: name: trigger workflow based on changed files runs-on: ubuntu-22.04 outputs: - check_container_image: ${{ steps.check_container_image.outputs.result }} + base_container_image: ${{ steps.base_container.outputs.image }} container_any_changed: ${{ steps.changed_files_yaml.outputs.container_any_changed }} - ghcr_url: ${{ steps.lower.outputs.ghcr_url }} image_any_changed: ${{ steps.changed_files_yaml.outputs.image_any_changed }} metadata_json: ${{ steps.metadata.outputs.json }} metadata_labels: ${{ steps.metadata.outputs.labels }} @@ -51,6 +50,7 @@ jobs: - '!**/*.md' - '!ha/**' - '!misc/**' + - name: extract metadata id: metadata uses: docker/metadata-action@v5 @@ -61,29 +61,19 @@ jobs: type=ref,event=pr type=ref,event=branch - - name: extract tag name - id: tag - run: | - tag=${{ fromJSON(steps.metadata.outputs.json).tags[0] }} - echo "tag=${tag##*:}" >> $GITHUB_OUTPUT - - - name: debug - run: | - echo "${{ steps.metadata.outputs.json }}" - echo "${{ steps.tag.outputs.tag }}" - - - uses: cloudposse/github-action-docker-image-exists@0.2.0 - continue-on-error: true - id: check_container_image + - name: select base branch container + id: base_container if: ${{ steps.changed_files_yaml.outputs.container_any_changed == 'false' && steps.changed_files_yaml.outputs.image_any_changed == 'true' }} - with: - image_name: "${{ github.repository }}" - registry: ghcr.io - tag: "${{ steps.tag.outputs.tag }}" - - - name: debug + env: + BASE_REF: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }} + REGISTRY_IMAGE: ${{ steps.lower.outputs.ghcr_url }} run: | - echo "${{ steps.check_container_image.outputs.result }}" + tag=$(printf '%s' "$BASE_REF" | sed 's/[^A-Za-z0-9_.-]/-/g') + image="$REGISTRY_IMAGE:$tag" + if ! docker manifest inspect "$image" >/dev/null 2>&1; then + image="$REGISTRY_IMAGE:main" + fi + echo "image=$image" >> "$GITHUB_OUTPUT" build_container: if: ${{ needs.trigger_workflow.outputs.container_any_changed == 'true' || github.ref_type == 'tag' }} @@ -99,4 +89,4 @@ jobs: uses: ./.github/workflows/build-willow.yml needs: trigger_workflow with: - container-image: ${{ needs.trigger_workflow.outputs.check_container_image && fromJSON(needs.trigger_workflow.outputs.metadata_json).tags[0] || format('{0}:main', needs.trigger_workflow.outputs.ghcr_url) }} + container-image: ${{ needs.trigger_workflow.outputs.base_container_image }} From e6c49efcba4e461ab999e25cb521ca82f80240e0 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:14:06 +0300 Subject: [PATCH 05/11] CI: cache build container layers Pull requests that change container inputs deliberately rebuild the container on every update so the firmware never uses stale tooling. Persist BuildKit layers in the GitHub Actions cache to make unchanged layers reusable across those builds. Configure the maintained Buildx setup action required to export the GitHub Actions cache. Pin its v4.2.0 commit instead of the mutable release tag, while recording the tag beside the reference for readability and automated updates. --- .github/workflows/build-container.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index f23ead0a..e9456254 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -33,9 +33,14 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: set up Docker Buildx + uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + - name: build container uses: docker/build-push-action@v6 with: + cache-from: type=gha,scope=willow-build-container + cache-to: type=gha,mode=max,scope=willow-build-container context: . file: ./Dockerfile push: true From 845ce39a18f3f4331427579fe4e38d67bb9ded8f Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:21:07 +0300 Subject: [PATCH 06/11] CI: remove obsolete build diagnostics Every container build still dumps its filesystem, identity, environment, and working directory. Its debug expression also refers to an input the reusable workflow does not define. Remove the bring-up diagnostics while retaining the working-directory, Git ownership, and ESP-IDF shell handling they helped establish. --- .github/workflows/build-container.yml | 3 --- .github/workflows/build-willow.yml | 27 --------------------------- .github/workflows/meta.yml | 1 - 3 files changed, 31 deletions(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index e9456254..280ad7c3 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -1,9 +1,6 @@ --- name: build-container -env: - GH_TOKEN: ${{ github.token }} - on: workflow_call: inputs: diff --git a/.github/workflows/build-willow.yml b/.github/workflows/build-willow.yml index 865f9b1a..02b3d03d 100644 --- a/.github/workflows/build-willow.yml +++ b/.github/workflows/build-willow.yml @@ -1,10 +1,6 @@ --- name: build-willow -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - on: workflow_call: inputs: @@ -41,23 +37,6 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - - name: debug - run: echo ${{ inputs.container-tag }} - - name: ls -al - run: ls -al - - name: ls -al / - run: ls -al / - # fatal: detected dubious ownership in repository at '/willow' - - name: id - run: id - # ./utils.sh: line 193: idf.py: command not found - # - name: . $IDF_PATH/export.sh - # run: . "$IDF_PATH/export.sh" - # need to run it in the same step as utils.sh bloody hell - - name: env - run: env - - name: pwd - run: pwd - name: add /willow to git safe directories run: git config --global --add safe.directory /willow # need to run with bash to avoid this error: @@ -115,12 +94,6 @@ jobs: with: pattern: '!*.dockerbuild' - - name: pwd - run: pwd - - - name: find -ls - run: find -ls - - name: create sha256sums.txt run: find -type f -name '*.sha256sum.txt' -exec cat {} + | sort -u > sha256sums.txt diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index e0c17fe4..3eb13f81 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -3,7 +3,6 @@ name: meta env: GHCR_URL: "ghcr.io/${{ github.repository }}" - GH_TOKEN: ${{ github.token }} on: pull_request: From 2aa327c476673fe3b2c7669465f602ccebfde607 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:22:53 +0300 Subject: [PATCH 07/11] CI: replace compromised changed-files action tj-actions/changed-files release tags through v45 were retargeted to a malicious commit in March 2025. It exposed runner secrets in workflow logs. Continuing to trust the mutable v45 tag is unnecessary. Use the narrower paths-filter action and pin its reviewed v4.0.2 commit. It provides the two boolean path groups this workflow needs without the custom shell implementation or a mutable action reference. --- .github/workflows/meta.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 3eb13f81..bfc817cb 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -19,8 +19,8 @@ jobs: runs-on: ubuntu-22.04 outputs: base_container_image: ${{ steps.base_container.outputs.image }} - container_any_changed: ${{ steps.changed_files_yaml.outputs.container_any_changed }} - image_any_changed: ${{ steps.changed_files_yaml.outputs.image_any_changed }} + container_any_changed: ${{ steps.paths.outputs.container }} + image_any_changed: ${{ steps.paths.outputs.image }} metadata_json: ${{ steps.metadata.outputs.json }} metadata_labels: ${{ steps.metadata.outputs.labels }} metadata_tags: ${{ steps.metadata.outputs.tags }} @@ -35,11 +35,13 @@ jobs: # Compare pull requests with their base and pushes with their previous head. fetch-depth: 0 - - uses: tj-actions/changed-files@v45 + - name: detect changed build inputs + uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 if: ${{ github.ref_type != 'tag' }} - id: changed_files_yaml + id: paths with: - files_yaml: | + base: ${{ github.ref_name }} + filters: | container: - '.github/workflows/build-container.yml' - 'Dockerfile' @@ -62,7 +64,7 @@ jobs: - name: select base branch container id: base_container - if: ${{ steps.changed_files_yaml.outputs.container_any_changed == 'false' && steps.changed_files_yaml.outputs.image_any_changed == 'true' }} + if: ${{ steps.paths.outputs.container == 'false' && steps.paths.outputs.image == 'true' }} env: BASE_REF: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }} REGISTRY_IMAGE: ${{ steps.lower.outputs.ghcr_url }} From c362aeb1dfa69c3983216fb98838f9243556fcd2 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:25:37 +0300 Subject: [PATCH 08/11] CI: remove stale formatting action wrappers The clang-format wrapper pulls a mutable container tag even when the action itself is pinned. Ubuntu 22.04 runners already provide the exact clang-format-15 release used by Willow, so invoke it directly. The EditorConfig wrapper has not been released since 2021. It installs an unpinned PyPI package and checks only the final commit. Use the maintained upstream setup action at an immutable commit and check the whole tree with a fixed editorconfig-checker release. --- .ecrc => .editorconfig-checker.json | 0 .github/workflows/code-formatting.yml | 16 ++++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) rename .ecrc => .editorconfig-checker.json (100%) diff --git a/.ecrc b/.editorconfig-checker.json similarity index 100% rename from .ecrc rename to .editorconfig-checker.json diff --git a/.github/workflows/code-formatting.yml b/.github/workflows/code-formatting.yml index bc83afbb..1ce1faf1 100644 --- a/.github/workflows/code-formatting.yml +++ b/.github/workflows/code-formatting.yml @@ -9,17 +9,17 @@ jobs: steps: - uses: actions/checkout@v4 - name: clang-format - uses: jidicula/clang-format-action@v4.14.0 - with: - clang-format-version: 15 - check-path: 'main' + run: | + git ls-files -z 'main/*.c' 'main/*.h' | + xargs -0 --no-run-if-empty clang-format-15 --dry-run --Werror editorconfig-checker: name: editorconfig-check runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - name: editorconfig-check - uses: wow-rp-addons/actions-editorconfig-check@v1.0.2 + - name: install editorconfig-checker + uses: editorconfig-checker/action-editorconfig-checker@840e866d93b8e032123c23bac69dece044d4d84c # v2.2.0 with: - files: $(git log -1 --name-only --pretty='') - + version: v3.8.0 + - name: editorconfig-check + run: editorconfig-checker From 05cfa1fd1a15f4e32f2e35fdd668adbcccd9038b Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:26:21 +0300 Subject: [PATCH 09/11] CI: update and pin official build actions Update the GitHub and Docker actions to their current Node 24 releases. The hosted Ubuntu runners meet their minimum runner requirement, and the workflows do not use any of the options with changed behavior. Pin every action to the full release commit so retargeting a version tag cannot change the code executed by the workflow. --- .github/workflows/build-container.yml | 6 +++--- .github/workflows/build-willow.yml | 10 +++++----- .github/workflows/code-formatting.yml | 4 ++-- .github/workflows/meta.yml | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 280ad7c3..b6e944b8 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -21,10 +21,10 @@ jobs: packages: write steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: login to ghcr.io - uses: docker/login-action@v3 + uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4.5.1 with: registry: ghcr.io username: ${{ github.actor }} @@ -34,7 +34,7 @@ jobs: uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 - name: build container - uses: docker/build-push-action@v6 + uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 with: cache-from: type=gha,scope=willow-build-container cache-to: type=gha,mode=max,scope=willow-build-container diff --git a/.github/workflows/build-willow.yml b/.github/workflows/build-willow.yml index 02b3d03d..54995dd3 100644 --- a/.github/workflows/build-willow.yml +++ b/.github/workflows/build-willow.yml @@ -36,7 +36,7 @@ jobs: packages: read steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: add /willow to git safe directories run: git config --global --add safe.directory /willow # need to run with bash to avoid this error: @@ -61,17 +61,17 @@ jobs: run: cd /willow/build && sha256sum "${{ env.dist_filename }}" > "${{ env.dist_filename }}.sha256sum.txt" - name: upload willow-dist.bin artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: "${{ env.dist_filename }}" path: "/willow/build/${{ env.dist_filename }}*" - name: upload willow-ota.bin artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: "${{ env.ota_filename }}" path: "/willow/build/${{ env.ota_filename }}*" - name: upload build artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: "${{ env.partitions_filename }}" path: | @@ -90,7 +90,7 @@ jobs: packages: read steps: - name: download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: pattern: '!*.dockerbuild' diff --git a/.github/workflows/code-formatting.yml b/.github/workflows/code-formatting.yml index 1ce1faf1..3aa31490 100644 --- a/.github/workflows/code-formatting.yml +++ b/.github/workflows/code-formatting.yml @@ -7,7 +7,7 @@ jobs: name: clang-format runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: clang-format run: | git ls-files -z 'main/*.c' 'main/*.h' | @@ -16,7 +16,7 @@ jobs: name: editorconfig-check runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: install editorconfig-checker uses: editorconfig-checker/action-editorconfig-checker@840e866d93b8e032123c23bac69dece044d4d84c # v2.2.0 with: diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index bfc817cb..66cc0700 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -30,7 +30,7 @@ jobs: run: | echo "ghcr_url=${GHCR_URL@L}" >> $GITHUB_OUTPUT - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # Compare pull requests with their base and pushes with their previous head. fetch-depth: 0 @@ -54,7 +54,7 @@ jobs: - name: extract metadata id: metadata - uses: docker/metadata-action@v5 + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: ${{ steps.lower.outputs.ghcr_url }} tags: | From 7a6885368c2008048216251e25066b2c9486e49c Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:26:37 +0300 Subject: [PATCH 10/11] CI: update and pin release action Update release-action within its compatible v1 series for the maintained Node 24 runtime and current GitHub API dependencies. Pin the exact release commit to prevent mutable-tag replacement in the publishing job. --- .github/workflows/build-willow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-willow.yml b/.github/workflows/build-willow.yml index 54995dd3..4d295951 100644 --- a/.github/workflows/build-willow.yml +++ b/.github/workflows/build-willow.yml @@ -98,7 +98,7 @@ jobs: run: find -type f -name '*.sha256sum.txt' -exec cat {} + | sort -u > sha256sums.txt - name: create release - uses: ncipollo/release-action@v1 + uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0 with: allowUpdates: false artifacts: "sha256sums.txt,willow-dist-*/willow-dist-*.bin,willow-ota-*/willow-ota-*.bin" From 278b2f610a03b3de8d8128eff06fcb8109544201 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 25 Jul 2026 16:27:01 +0300 Subject: [PATCH 11/11] CI: automate pinned action updates Immutable action commits prevent tag retargeting from changing workflow code, but they also require an explicit update path. Ask Dependabot to open one grouped monthly update for GitHub Actions dependencies. --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..952971ce --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +--- +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + groups: + github-actions: + patterns: + - '*'