diff --git a/action.yml b/action.yml index f6df592..caef5c8 100644 --- a/action.yml +++ b/action.yml @@ -53,6 +53,12 @@ outputs: description: The URL of the workflow that was triggered by this action conclusion: description: Conclusion of the job, i.e pass/failure + workflow_run_id: + description: The ID of the triggered workflow run triggered by this action + full_sha: + description: The full SHA of commit that triggered the workflow + short_sha: + description: The short SHA of commit that triggered the workflow first 10 chars runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 58dca5f..2de36e6 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -101,7 +101,7 @@ api() { echo >&2 "api failed:" echo >&2 "path: $path" echo >&2 "response: $response" - if [[ "$response" == *'"Server Error"'* ]]; then + if [[ "$response" == *'"Server Error"'* ]]; then echo "Server error - trying again" else exit 1 @@ -196,6 +196,14 @@ wait_for_workflow_to_finish() { echo "conclusion=${conclusion}" >> $GITHUB_OUTPUT done + # Add the run ID to the outputs of the action + workflow=$(api "runs/$last_workflow_id") + workflow_run_id=$(echo "${workflow}" | jq -r '.id') + echo "workflow_run_id=${workflow_run_id}" >> $GITHUB_OUTPUT + head_sha=$(echo "${workflow}" | jq -r '.head_sha') + echo "full_sha=${head_sha}" >> $GITHUB_OUTPUT + echo "short_sha=${head_sha:0:10}" >> $GITHUB_OUTPUT + if [[ "${conclusion}" == "success" && "${status}" == "completed" ]] then echo "Yes, success"