Skip to content

report-cloud-tests-pr-progress #3

report-cloud-tests-pr-progress

report-cloud-tests-pr-progress #3

name: Report Cloud Test Status
on:
repository_dispatch:
types: [report-cloud-tests-pr-progress]
jobs:
reporter:
permissions:
checks: write
statuses: write
runs-on: ubuntu-latest
steps:
- name: Output
env:
#MESSAGE: ${{ github.event.client_payload.message }}
MESSAGE: ${{ toJSON(github.event.client_payload) }}
run: echo $MESSAGE
- name: Report status
env:
DESC: ${{ github.event.client_payload.desc }}
PR_HEAD_SHA: ${{ github.event.client_payload.prHeadSha }}
RUN_URL: ${{ github.event.client_payload.runUrl }}
STATE: ${{ github.event.client_payload.state }}
run: |
JSON_STRING=$(jq -c -n \
--arg state "$STATE" \
--arg tgt "$RUN_URL" \
--arg desc "$DESC" \
'{state: $state, target_url: $tgt, description: $desc, context: "Build and Test Workflow Run/build (workflow_run)"}' )
curl -L -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${GH_TOKEN}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/statuses/${ PR_HEAD_SHA } \
-d "${JSON_STRING}"