From c132bc7f42594e2ad0a142320eb5a3ff3904abe1 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 31 Aug 2026 15:38:17 -0400 Subject: [PATCH] Add a composite action that modifies rust version This composite action works by setting the directory-specific rustup override. Signed-off-by: mulhern --- set-rust-toolchain/action.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 set-rust-toolchain/action.yml diff --git a/set-rust-toolchain/action.yml b/set-rust-toolchain/action.yml new file mode 100644 index 0000000..35238ea --- /dev/null +++ b/set-rust-toolchain/action.yml @@ -0,0 +1,21 @@ +--- +name: 'Override rust version with MSRV' +description: "Override rust version with MSRV" +inputs: + working-directory: + description: "The working directory for this action" + required: false + default: '.' + +runs: + using: "composite" + steps: + - name: Set rustup override to MSRV + shell: bash + run: | + CRATE=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].name') + MSRV=$(cargo metadata --format-version 1 --no-deps | jq -r --arg CRATE "$CRATE" ' + .packages[] | select(.name == $CRATE) | .rust_version // empty + ') + rustup override set "$MSRV" + working-directory: ${{ inputs.working-directory }}