From 48bc37e4fc15c0dc64c1cfa19a7430501e5b4412 Mon Sep 17 00:00:00 2001 From: bwhitehead0 Date: Sun, 29 Sep 2024 13:59:30 -0500 Subject: [PATCH 1/7] testing GITHUB_WORKSPACE use --- assets/runner_info.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/runner_info.sh b/assets/runner_info.sh index d9efaba..4c0adb9 100755 --- a/assets/runner_info.sh +++ b/assets/runner_info.sh @@ -1,5 +1,7 @@ #!/bin/bash +echo "\$GITHUB_WORKSPACE: $GITHUB_WORKSPACE" + # action version VERSION="1.1.0" # Get OS name From 410ba22168ecb7dfc55571e2e4aea7d8d8c7e962 Mon Sep 17 00:00:00 2001 From: bwhitehead0 Date: Sun, 29 Sep 2024 14:08:10 -0500 Subject: [PATCH 2/7] parameter expansion using builtin var to determine specific runner path when there are multiple runner services on the system --- assets/runner_info.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/runner_info.sh b/assets/runner_info.sh index 4c0adb9..1c05984 100755 --- a/assets/runner_info.sh +++ b/assets/runner_info.sh @@ -1,6 +1,7 @@ #!/bin/bash echo "\$GITHUB_WORKSPACE: $GITHUB_WORKSPACE" +echo "from GITHUB_WORKSPACE: $(${GITHUB_WORKSPACE%work_*})" # action version VERSION="1.1.0" From 893a09470d6521ac98994d70e3e51746c87e5cd3 Mon Sep 17 00:00:00 2001 From: bwhitehead0 Date: Sun, 29 Sep 2024 14:10:13 -0500 Subject: [PATCH 3/7] different way for parameter expansion --- assets/runner_info.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/runner_info.sh b/assets/runner_info.sh index 1c05984..4c8c236 100755 --- a/assets/runner_info.sh +++ b/assets/runner_info.sh @@ -1,7 +1,8 @@ #!/bin/bash echo "\$GITHUB_WORKSPACE: $GITHUB_WORKSPACE" -echo "from GITHUB_WORKSPACE: $(${GITHUB_WORKSPACE%work_*})" +folder=${GITHUB_WORKSPACE%work_*} +echo "from GITHUB_WORKSPACE: $folder" # action version VERSION="1.1.0" From c92e3ede5bcf42a53e47ceccbb01cccad6e07695 Mon Sep 17 00:00:00 2001 From: bwhitehead0 Date: Sun, 29 Sep 2024 14:12:12 -0500 Subject: [PATCH 4/7] fix dir name --- assets/runner_info.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/runner_info.sh b/assets/runner_info.sh index 4c8c236..3e02a1a 100755 --- a/assets/runner_info.sh +++ b/assets/runner_info.sh @@ -1,7 +1,7 @@ #!/bin/bash echo "\$GITHUB_WORKSPACE: $GITHUB_WORKSPACE" -folder=${GITHUB_WORKSPACE%work_*} +folder=${GITHUB_WORKSPACE%_work} echo "from GITHUB_WORKSPACE: $folder" # action version From f61962d51ca1ff0c292b976631b939c8293e27f2 Mon Sep 17 00:00:00 2001 From: bwhitehead0 Date: Sun, 29 Sep 2024 14:27:33 -0500 Subject: [PATCH 5/7] fixed parameter expansion, '%%' --- assets/runner_info.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/assets/runner_info.sh b/assets/runner_info.sh index 3e02a1a..f969347 100755 --- a/assets/runner_info.sh +++ b/assets/runner_info.sh @@ -1,8 +1,7 @@ #!/bin/bash echo "\$GITHUB_WORKSPACE: $GITHUB_WORKSPACE" -folder=${GITHUB_WORKSPACE%_work} -echo "from GITHUB_WORKSPACE: $folder" +echo "from GITHUB_WORKSPACE: ${GITHUB_WORKSPACE%%_work*}" # action version VERSION="1.1.0" From 8805b2854b3e993d5c9832d9d9a72e4b7fb00141 Mon Sep 17 00:00:00 2001 From: bwhitehead0 Date: Sun, 29 Sep 2024 14:33:04 -0500 Subject: [PATCH 6/7] working param expansion. updated code determining runner path --- assets/runner_info.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/runner_info.sh b/assets/runner_info.sh index f969347..5813fc9 100755 --- a/assets/runner_info.sh +++ b/assets/runner_info.sh @@ -41,7 +41,10 @@ if pgrep "runsvc.sh" >/dev/null; then # runner is running and we can easily find the disk it's installed on # ignore shellcheck warning as pidof isn't going to get us what we need here # shellcheck disable=SC2009 - RUNNER_PATH="$(dirname "$(ps aux | grep -w "[r]unsvc.sh" | awk '{print $12}')")" + + # replacing with using builtin GITHUB_WORKSPACE variable and parameter expansion to determine path. surrounding if block likely superfluous now. + #RUNNER_PATH="$(dirname "$(ps aux | grep -w "[r]unsvc.sh" | awk '{print $12}')")" + RUNNER_PATH=${GITHUB_WORKSPACE%%_work*} else # runner is not running, so we'll just default to blank RUNNER_PATH="" From b362ea8bf3c4efad2858ed751d4921e1a4e548c7 Mon Sep 17 00:00:00 2001 From: bwhitehead0 Date: Sun, 29 Sep 2024 14:39:29 -0500 Subject: [PATCH 7/7] resolves #11. version bump to v1.1.1. determines runner path for subsequent data collection properly when there are multiple actions runner services installed/running on the system. --- assets/runner_info.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/assets/runner_info.sh b/assets/runner_info.sh index 5813fc9..9eec5cb 100755 --- a/assets/runner_info.sh +++ b/assets/runner_info.sh @@ -1,10 +1,7 @@ #!/bin/bash -echo "\$GITHUB_WORKSPACE: $GITHUB_WORKSPACE" -echo "from GITHUB_WORKSPACE: ${GITHUB_WORKSPACE%%_work*}" - # action version -VERSION="1.1.0" +VERSION="1.1.1" # Get OS name OS_NAME=$(grep "PRETTY_NAME=" /etc/os-release | cut -d'"' -f2) # https://unix.stackexchange.com/a/34033 - get uptime from /proc/uptime in human readable format