Add Repository information to Runner Status (#2093)

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
Stephane Moser
2023-01-18 00:09:45 +00:00
committed by GitHub
parent de244a17be
commit 606ed1b28e
5 changed files with 157 additions and 2 deletions

View File

@@ -15,9 +15,30 @@ if [[ ${RUNNER_STATUS_UPDATE_HOOK:-false} == true ]]; then
namespace=$(cat ${serviceaccount}/namespace)
token=$(cat ${serviceaccount}/token)
phase=$1
shift
message=${2:-}
jq -n --arg phase "$phase" --arg message "${*:-}" '.status.phase = $phase | .status.message = $message' | curl \
data=$(jq -n --arg phase "$phase" \
--arg message "$message" \
--arg workflow_repository "${GITHUB_REPOSITORY:-}" \
--arg workflow_repository_owner "${GITHUB_REPOSITORY_OWNER:-}" \
--arg workflow_name "${GITHUB_WORKFLOW:-}" \
--arg workflow_run_id "${GITHUB_RUN_ID:-}" \
--arg workflow_run_number "${GITHUB_RUN_NUMBER:-}" \
--arg workflow_job "${GITHUB_JOB:-}" \
--arg workflow_action "${GITHUB_ACTION:-}" \
'
.status.phase = $phase
| .status.message = $message
| .status.workflow.name = $workflow_name
| .status.workflow.runID = $workflow_run_id
| .status.workflow.runNumber = $workflow_run_number
| .status.workflow.repository = $workflow_repository
| .status.workflow.repositoryOwner = $workflow_repository_owner
| .status.workflow.job = $workflow_job
| .status.workflow.action = $workflow_action
')
echo "$data" | curl \
--cacert ${serviceaccount}/ca.crt \
--data @- \
--noproxy '*' \