diff --git a/VERSION b/VERSION index 6016e8add..8ac28bf9f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.6.0 +4.6.1 diff --git a/actions/instrument/job/inject_and_init.bash b/actions/instrument/job/inject_and_init.bash index 4b4b170db..7e165843e 100644 --- a/actions/instrument/job/inject_and_init.bash +++ b/actions/instrument/job/inject_and_init.bash @@ -1,5 +1,16 @@ set -e +if [ -z "$GITHUB_ACTION_REPOSITORY" ]; then export GITHUB_ACTION_REPOSITORY="$GITHUB_REPOSITORY"; fi +action_tag_name="$(echo "$GITHUB_ACTION_REF" | cut -sd @ -f 2-)" +if [ -n "$action_tag_name" ]; then + debian_file="$(mktemp)" + curl "$GITHUB_API_URL"/repos/"$GITHUB_ACTION_REPOSITORY"/releases | { if [ "$action_tag_name" = main ]; then jq '.[0]'; else jq '.[] | select(.tag_name=="'"$action_tag_name"'")'; fi } | jq -r '.assets[] | .browser_download_url' | xargs wget -O "$debian_file" + sudo apt-get install -y "$debian_file" + rm "$debian_file" +else + wget -O - https://raw.githubusercontent.com/"$GITHUB_ACTION_REPOSITORY"/main/INSTALL.sh | sh -E +fi + root4job_end() { if [ "$(curl "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/jobs" | jq -r ".jobs[] | select(.name==\"$GITHUB_JOB\") | select(.run_attempt==\"$GITHUB_RUN_ATTEMPT\") | .steps[] | select(.status==\"completed\") | select(.conclusion==\"failure\") | .name" | wc -l)" -gt 0 ]; then otel_span_error "$span_handle" diff --git a/actions/instrument/job/inject_and_init.js b/actions/instrument/job/inject_and_init.js index d8bf01586..bfdb366be 100644 --- a/actions/instrument/job/inject_and_init.js +++ b/actions/instrument/job/inject_and_init.js @@ -10,5 +10,4 @@ function run(executable, args = []) { }); } -run('/bin/sh', [ '-c', 'wget -O - https://raw.githubusercontent.com/plengauer/opentelemetry-bash/main/INSTALL.sh | sh -E' ]) - .then(() => run('/bin/bash', [ '-e', __dirname + '/inject_and_init.bash' ])) +run('/bin/bash', [ '-e', __dirname + '/inject_and_init.bash' ]) diff --git a/actions/instrument/job/nop.js b/actions/instrument/job/nop.js index 459506a7e..0f86c2e6b 100644 --- a/actions/instrument/job/nop.js +++ b/actions/instrument/job/nop.js @@ -1,5 +1,5 @@ const process = require('process'); -if (process.env['GITHUB_REPOSITORY'] == 'plengauer/opentelemetry-bash') { +if (!process.env['GITHUB_ACTION_REPOSITORY'] || process.env['GITHUB_REPOSITORY'] == process.env['GITHUB_ACTION_REPOSITORY']) { // action is local and pre steps is not supported because the action needs to be checked out first and then its too let to execute a pre step require('./inject_and_init.js'); }