@@ -93,39 +93,11 @@ jobs:
9393
9494 - name : Update status for rcc (pending)
9595 if : github.actor != 'Copilot' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
96- # FIXME: Wrap into action
97- # `inputs.ref` is free-form text supplied by whoever dispatched the run
98- # and `github.workflow` comes from the workflow file of the ref under
99- # test, so both are passed through the environment rather than spliced
100- # into the script with `${{ }}`.
101- env :
102- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
103- REPO : ${{ github.repository }}
104- RUN_ID : ${{ github.run_id }}
105- INPUT_REF : ${{ inputs.ref }}
106- EVENT_SHA : ${{ github.sha }}
107- DESCRIPTION : ${{ github.workflow }} / ${{ github.job }}
108- run : |
109- set -euo pipefail
110- echo "Actor: ${{ github.actor }}"
111-
112- # Check status of this workflow
113- state="pending"
114- sha="${INPUT_REF:-${EVENT_SHA}}"
115- sha=$(git rev-parse "${sha}")
116-
117- html_url=$(gh api \
118- -H "Accept: application/vnd.github+json" \
119- -H "X-GitHub-Api-Version: 2022-11-28" \
120- "repos/${REPO}/actions/runs/${RUN_ID}" | jq -r .html_url)
121-
122- gh api \
123- --method POST \
124- -H "Accept: application/vnd.github+json" \
125- -H "X-GitHub-Api-Version: 2022-11-28" \
126- "repos/${REPO}/statuses/${sha}" \
127- -f "state=${state}" -f "target_url=${html_url}" -f "description=${DESCRIPTION}" -f "context=rcc"
128- shell : bash
96+ uses : ./.github/workflows/commit-status
97+ with :
98+ token : ${{ secrets.GITHUB_TOKEN }}
99+ state : pending
100+ sha : ${{ inputs.ref }}
129101
130102 - name : Report the GitHub API rate limit
131103 uses : ./.github/workflows/rate-limit
@@ -297,77 +269,22 @@ jobs:
297269 shell : bash
298270
299271 - name : Update status for rcc (final)
300- # FIXME: Wrap into action
301272 if : always() && (github.actor != 'Copilot') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
302- env :
303- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
304- REPO : ${{ github.repository }}
305- RUN_ID : ${{ github.run_id }}
306- JOB_STATUS : ${{ job.status }}
307- COMMIT_SHA : ${{ steps.commit.outputs.sha }}
308- INPUT_REF : ${{ inputs.ref }}
309- EVENT_SHA : ${{ github.sha }}
310- DESCRIPTION : ${{ github.workflow }} / ${{ github.job }}
311- run : |
312- set -euo pipefail
313- # Check status of this workflow
314- if [ "${JOB_STATUS}" = "success" ]; then
315- state="success"
316- else
317- state="failure"
318- fi
319-
320- sha="${COMMIT_SHA:-${INPUT_REF:-${EVENT_SHA}}}"
321- sha=$(git rev-parse "${sha}")
322-
323- html_url=$(gh api \
324- -H "Accept: application/vnd.github+json" \
325- -H "X-GitHub-Api-Version: 2022-11-28" \
326- "repos/${REPO}/actions/runs/${RUN_ID}" | jq -r .html_url)
327-
328- gh api \
329- --method POST \
330- -H "Accept: application/vnd.github+json" \
331- -H "X-GitHub-Api-Version: 2022-11-28" \
332- "repos/${REPO}/statuses/${sha}" \
333- -f "state=${state}" -f "target_url=${html_url}" -f "description=${DESCRIPTION}" -f "context=rcc"
334- shell : bash
273+ uses : ./.github/workflows/commit-status
274+ with :
275+ token : ${{ secrets.GITHUB_TOKEN }}
276+ state : ${{ job.status }}
277+ # The commit that the commit-back step created, if there was one
278+ sha : ${{ steps.commit.outputs.sha || inputs.ref }}
335279
336280 - name : Update status for rcc (Copilot)
337281 # Update status directly when triggered by Copilot or bots, since they can't dispatch workflows
338282 if : always() && (github.actor == 'Copilot')
339- env :
340- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
341- REPO : ${{ github.repository }}
342- RUN_ID : ${{ github.run_id }}
343- JOB_STATUS : ${{ job.status }}
344- INPUT_REF : ${{ inputs.ref }}
345- EVENT_SHA : ${{ github.sha }}
346- DESCRIPTION : ${{ github.workflow }} / ${{ github.job }}
347- run : |
348- set -euo pipefail
349- # Set status to success if job succeeded, failure otherwise
350- if [ "${JOB_STATUS}" = "success" ]; then
351- state="success"
352- else
353- state="failure"
354- fi
355-
356- sha="${INPUT_REF:-${EVENT_SHA}}"
357- sha=$(git rev-parse "${sha}")
358-
359- html_url=$(gh api \
360- -H "Accept: application/vnd.github+json" \
361- -H "X-GitHub-Api-Version: 2022-11-28" \
362- "repos/${REPO}/actions/runs/${RUN_ID}" | jq -r .html_url)
363-
364- gh api \
365- --method POST \
366- -H "Accept: application/vnd.github+json" \
367- -H "X-GitHub-Api-Version: 2022-11-28" \
368- "repos/${REPO}/statuses/${sha}" \
369- -f "state=${state}" -f "target_url=${html_url}" -f "description=${DESCRIPTION}" -f "context=rcc"
370- shell : bash
283+ uses : ./.github/workflows/commit-status
284+ with :
285+ token : ${{ secrets.GITHUB_TOKEN }}
286+ state : ${{ job.status }}
287+ sha : ${{ inputs.ref }}
371288
372289 rcc-smoke-check-matrix :
373290 runs-on : ubuntu-26.04
0 commit comments