From 09373f55d2dc3829d325c68e871035f17ae6dba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 22:07:02 +0000 Subject: [PATCH 01/11] --- install/action.yaml | 27 +++++++++++++++++++++++++++ install/get_trunk.sh | 20 ++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 install/action.yaml create mode 100755 install/get_trunk.sh diff --git a/install/action.yaml b/install/action.yaml new file mode 100644 index 00000000..03fd23a3 --- /dev/null +++ b/install/action.yaml @@ -0,0 +1,27 @@ +name: Trunk Check +author: trunk.io +description: Install trunk and managed tools to PATH + +inputs: + tools: + description: specific tools to install (if not specified will install all enabled tools) + required: false + +branding: + icon: check + color: green + +runs: + using: composite + steps: + - name: get trunk + shell: bash + run: ${GITHUB_ACTION_PATH}/get_trunk.sh + + - name: Add .trunk/tools to path + shell: bash + if: runner.os == 'Linux' || runner.os == 'macOS' + run: echo ".trunk/tools" >> $GITHUB_PATH + + - name: Trunk install + run: trunk install --ci ${{ inputs.tools }} diff --git a/install/get_trunk.sh b/install/get_trunk.sh new file mode 100755 index 00000000..9af56dfb --- /dev/null +++ b/install/get_trunk.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -euo pipefail + +if [[ ${INPUT_DEBUG:-false} == "true" ]]; then + set -x +fi + +tmpdir="$(mktemp -d)" +echo "TRUNK_TMPDIR=${tmpdir}" >>"${GITHUB_ENV}" + +curl -fsSL https://trunk.io/releases/trunk -o "${tmpdir}/trunk" +chmod u+x "${tmpdir}/trunk" +trunk_path="${tmpdir}/trunk" + +echo "TRUNK_PATH=${trunk_path}" >>"${GITHUB_ENV}" +echo ${tmpdir} >>$GITHUB_PATH + +# Ensure that trunk CLI is downloaded before subsequent steps +(${trunk_path} version 2>&1) || echo "::warning::${trunk_path} does not exist!" From 3cde29b0ce41bfa18d43701359971fe1ed98f83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 22:10:51 +0000 Subject: [PATCH 02/11] --- e | 12 ++++++++++++ f | 5 +++++ install/get_trunk.sh | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 e create mode 100644 f diff --git a/e b/e new file mode 100644 index 00000000..03357897 --- /dev/null +++ b/e @@ -0,0 +1,12 @@ +TRUNK_TMPDIR=/tmp/tmp.hG1IHSvSTW +TRUNK_PATH=/tmp/tmp.hG1IHSvSTW/trunk +TRUNK_TMPDIR=/tmp/tmp.DjKbPQMXyV +TRUNK_PATH=/tmp/tmp.DjKbPQMXyV/trunk +TRUNK_TMPDIR=/tmp/tmp.wMl6qLUCDB +TRUNK_PATH=/tmp/tmp.wMl6qLUCDB/trunk +TRUNK_TMPDIR=/tmp/tmp.kNmsgeprGa +TRUNK_PATH=/tmp/tmp.kNmsgeprGa/trunk +TRUNK_TMPDIR=/tmp/tmp.u8j06ig5I2 +TRUNK_PATH=/tmp/tmp.u8j06ig5I2/trunk +TRUNK_TMPDIR=/tmp/tmp.EzBwoyDUSi +TRUNK_PATH=/tmp/tmp.EzBwoyDUSi/trunk diff --git a/f b/f new file mode 100644 index 00000000..906a084f --- /dev/null +++ b/f @@ -0,0 +1,5 @@ +/tmp/tmp.DjKbPQMXyV +/tmp/tmp.wMl6qLUCDB +/tmp/tmp.kNmsgeprGa +/tmp/tmp.u8j06ig5I2 +/tmp/tmp.EzBwoyDUSi diff --git a/install/get_trunk.sh b/install/get_trunk.sh index 9af56dfb..970f6403 100755 --- a/install/get_trunk.sh +++ b/install/get_trunk.sh @@ -17,4 +17,4 @@ echo "TRUNK_PATH=${trunk_path}" >>"${GITHUB_ENV}" echo ${tmpdir} >>$GITHUB_PATH # Ensure that trunk CLI is downloaded before subsequent steps -(${trunk_path} version 2>&1) || echo "::warning::${trunk_path} does not exist!" +(${trunk_path} version >/dev/null 2>&1) || echo "::warning::${trunk_path} does not exist!" From dca9d2800f32864a30454eb8ee53206f8bfb21cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 22:10:57 +0000 Subject: [PATCH 03/11] --- e | 12 ------------ f | 5 ----- 2 files changed, 17 deletions(-) delete mode 100644 e delete mode 100644 f diff --git a/e b/e deleted file mode 100644 index 03357897..00000000 --- a/e +++ /dev/null @@ -1,12 +0,0 @@ -TRUNK_TMPDIR=/tmp/tmp.hG1IHSvSTW -TRUNK_PATH=/tmp/tmp.hG1IHSvSTW/trunk -TRUNK_TMPDIR=/tmp/tmp.DjKbPQMXyV -TRUNK_PATH=/tmp/tmp.DjKbPQMXyV/trunk -TRUNK_TMPDIR=/tmp/tmp.wMl6qLUCDB -TRUNK_PATH=/tmp/tmp.wMl6qLUCDB/trunk -TRUNK_TMPDIR=/tmp/tmp.kNmsgeprGa -TRUNK_PATH=/tmp/tmp.kNmsgeprGa/trunk -TRUNK_TMPDIR=/tmp/tmp.u8j06ig5I2 -TRUNK_PATH=/tmp/tmp.u8j06ig5I2/trunk -TRUNK_TMPDIR=/tmp/tmp.EzBwoyDUSi -TRUNK_PATH=/tmp/tmp.EzBwoyDUSi/trunk diff --git a/f b/f deleted file mode 100644 index 906a084f..00000000 --- a/f +++ /dev/null @@ -1,5 +0,0 @@ -/tmp/tmp.DjKbPQMXyV -/tmp/tmp.wMl6qLUCDB -/tmp/tmp.kNmsgeprGa -/tmp/tmp.u8j06ig5I2 -/tmp/tmp.EzBwoyDUSi From 472de5b96dbc5d74afc9cd2c99fb4919fc89d0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 22:11:16 +0000 Subject: [PATCH 04/11] update tool --- install/get_trunk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/get_trunk.sh b/install/get_trunk.sh index 970f6403..f6153591 100755 --- a/install/get_trunk.sh +++ b/install/get_trunk.sh @@ -16,5 +16,5 @@ trunk_path="${tmpdir}/trunk" echo "TRUNK_PATH=${trunk_path}" >>"${GITHUB_ENV}" echo ${tmpdir} >>$GITHUB_PATH -# Ensure that trunk CLI is downloaded before subsequent steps +# Ensure that trunk CLI is downloaded before subsequent steps (swallow output of version command) (${trunk_path} version >/dev/null 2>&1) || echo "::warning::${trunk_path} does not exist!" From 8fb16c7be417bcef27d789d7d59c272822441955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 22:17:23 +0000 Subject: [PATCH 05/11] --- install/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/action.yaml b/install/action.yaml index 03fd23a3..67140a5b 100644 --- a/install/action.yaml +++ b/install/action.yaml @@ -20,8 +20,8 @@ runs: - name: Add .trunk/tools to path shell: bash - if: runner.os == 'Linux' || runner.os == 'macOS' run: echo ".trunk/tools" >> $GITHUB_PATH - name: Trunk install + shell: bash run: trunk install --ci ${{ inputs.tools }} From 2600f5fd8319ecf2e6eefa6ca251e78cd6cff99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 22:38:22 +0000 Subject: [PATCH 06/11] --- install/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/action.yaml b/install/action.yaml index 67140a5b..3d96f624 100644 --- a/install/action.yaml +++ b/install/action.yaml @@ -24,4 +24,4 @@ runs: - name: Trunk install shell: bash - run: trunk install --ci ${{ inputs.tools }} + run: trunk tools install --ci ${{ inputs.tools }} From cb04be1525f1752cd780827f4e0e59877171e496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 22:39:14 +0000 Subject: [PATCH 07/11] --- install/action.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/install/action.yaml b/install/action.yaml index 3d96f624..afe36bf6 100644 --- a/install/action.yaml +++ b/install/action.yaml @@ -18,10 +18,14 @@ runs: shell: bash run: ${GITHUB_ACTION_PATH}/get_trunk.sh + - name: Trunk install + shell: bash + run: trunk tools install --ci ${{ inputs.tools }} + - name: Add .trunk/tools to path shell: bash run: echo ".trunk/tools" >> $GITHUB_PATH - - name: Trunk install + - name: path shell: bash - run: trunk tools install --ci ${{ inputs.tools }} + run: echo $GITHUB_PATH From 326cd38e8638d5836a71c23a38ab8e9d61260e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 22:44:31 +0000 Subject: [PATCH 08/11] --- install/action.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install/action.yaml b/install/action.yaml index afe36bf6..3a71fa27 100644 --- a/install/action.yaml +++ b/install/action.yaml @@ -18,6 +18,10 @@ runs: shell: bash run: ${GITHUB_ACTION_PATH}/get_trunk.sh + - name: which-trunk- + shell: bash + run: which trunk + - name: Trunk install shell: bash run: trunk tools install --ci ${{ inputs.tools }} From f41bb3bc7a56c357d7674441ab4ff6c7d49bd3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 23:05:37 +0000 Subject: [PATCH 09/11] --- install/action.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install/action.yaml b/install/action.yaml index 3a71fa27..e066f7c7 100644 --- a/install/action.yaml +++ b/install/action.yaml @@ -18,9 +18,13 @@ runs: shell: bash run: ${GITHUB_ACTION_PATH}/get_trunk.sh - - name: which-trunk- + - name: clean up dead symlink shell: bash - run: which trunk + run: | + tools_path=".trunk/tools" + if [ -L "${tools_path}" ] && [ ! -e "${tools_path}" ] ; then + rm "${tools_path}" + fi - name: Trunk install shell: bash @@ -29,7 +33,3 @@ runs: - name: Add .trunk/tools to path shell: bash run: echo ".trunk/tools" >> $GITHUB_PATH - - - name: path - shell: bash - run: echo $GITHUB_PATH From 54ccfcf9add644a36a5aa1d0046c92f654ff9e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Thu, 21 Mar 2024 23:05:52 +0000 Subject: [PATCH 10/11] --- install/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/action.yaml b/install/action.yaml index e066f7c7..40642f10 100644 --- a/install/action.yaml +++ b/install/action.yaml @@ -18,7 +18,7 @@ runs: shell: bash run: ${GITHUB_ACTION_PATH}/get_trunk.sh - - name: clean up dead symlink + - name: clean up possible dead symlink shell: bash run: | tools_path=".trunk/tools" From f8bc3b29af20e5151664605b776a1b6be0fe27d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEli?= Date: Sat, 23 Mar 2024 04:32:56 +0000 Subject: [PATCH 11/11] --- install/get_trunk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/get_trunk.sh b/install/get_trunk.sh index f6153591..e5acafb9 100755 --- a/install/get_trunk.sh +++ b/install/get_trunk.sh @@ -14,7 +14,7 @@ chmod u+x "${tmpdir}/trunk" trunk_path="${tmpdir}/trunk" echo "TRUNK_PATH=${trunk_path}" >>"${GITHUB_ENV}" -echo ${tmpdir} >>$GITHUB_PATH +echo "${tmpdir}" >>"${GITHUB_PATH}" # Ensure that trunk CLI is downloaded before subsequent steps (swallow output of version command) (${trunk_path} version >/dev/null 2>&1) || echo "::warning::${trunk_path} does not exist!"