From 9a1618ffb70e8374ab5f48fcccea3ebeacf57971 Mon Sep 17 00:00:00 2001 From: Dave Rolsky Date: Sun, 20 Jul 2025 12:57:58 -0500 Subject: [PATCH] Add a newline after each `rust-cache` parameter when running them to `GITHUB_OUTPUT` This fixes a bug where setting anything in `rust-cache-parameters` caused the input to the `rust-cache` to be broken. --- .github/workflows/test.yml | 5 +++++ Changes.md | 6 ++++++ parse-and-set-rust-cache-parameters.py | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66f4997..22333ce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -338,6 +338,11 @@ jobs: toolchain: ${{ matrix.platform.toolchain || 'stable' }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} strip: true + # This is the default cache-provider. This is just added to make sure that we handle + # additional rust-cache parameters properly. See + # https://github.com/houseabsolute/actions-rust-cross/issues/46 for an example of how this + # was broken. + rust-cache-parameters: '{ "cache-provider": "github" }' - name: Check binary and cross for main crate on ${{ matrix.platform.name }} shell: bash run: | diff --git a/Changes.md b/Changes.md index 110a080..0edae12 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,9 @@ +## 1.0.5 - 2025-07-20 + +- Fixed a bug in the handling of the `rust-cache-parameters` input. If anything was specified for + this, it would end up providing a broken config to the `Swatinem/rust-cache` action. Reported by + @SinTan1729 (Sayantan Santra). GH #46. + ## 1.0.4 - 2025-04-12 - Removed validation for the `toolchain` input. The diff --git a/parse-and-set-rust-cache-parameters.py b/parse-and-set-rust-cache-parameters.py index e584e28..8af4902 100755 --- a/parse-and-set-rust-cache-parameters.py +++ b/parse-and-set-rust-cache-parameters.py @@ -35,7 +35,7 @@ def main(): file = os.environ["GITHUB_OUTPUT"] with open(file, "w") as f: for key, value in parameters.items(): - f.write(f"{key}={value}") + f.write(f"{key}={value}\n") def get_file_hash(build_command):