From 1a50e2fc3187dc3818a219124c933c09c7a4a811 Mon Sep 17 00:00:00 2001 From: Njegos Date: Fri, 4 Oct 2024 14:30:24 +0200 Subject: [PATCH] RE-3058 Adding support for generating .tool-versions default file --- .changeset/afraid-rings-wonder.md | 5 +++++ actions/ci-prettier/action.yml | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .changeset/afraid-rings-wonder.md diff --git a/.changeset/afraid-rings-wonder.md b/.changeset/afraid-rings-wonder.md new file mode 100644 index 00000000..b34698fa --- /dev/null +++ b/.changeset/afraid-rings-wonder.md @@ -0,0 +1,5 @@ +--- +"ci-prettier": patch +--- + +Adding support for creating default .tool-versions file diff --git a/actions/ci-prettier/action.yml b/actions/ci-prettier/action.yml index b109f20a..f7489c4a 100644 --- a/actions/ci-prettier/action.yml +++ b/actions/ci-prettier/action.yml @@ -21,6 +21,11 @@ inputs: description: "" required: false default: ".tool-versions" + nodejs-version: + description: + "NodeJS version used only if the node-version-file isn't provided" + required: false + default: "^20.16.0" pnpm-version: description: "" required: false @@ -54,6 +59,13 @@ runs: with: fetch-depth: ${{ inputs.checkout-repo-fetch-depth }} + - name: Create .tool-versions file if it doesn't exist + shell: bash + run: | + if [ ! -f "${{ inputs.node-version-file }}" ]; then + echo "nodejs ${{ inputs.nodejs-version }}" > ${{ inputs.node-version-file }} + fi + - name: Setup nodejs uses: smartcontractkit/.github/actions/setup-nodejs@5b1046c28343660ecb84844c6fa95a66d1cdb52e # setup-nodejs@0.2.1 with: