Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions .github/workflows/fork-integration-status-reporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,32 @@ on:
permissions:
statuses: write

env:
GH_TOKEN: ${{ github.token }}

jobs:
report:
name: Report status
runs-on: ubuntu-latest
# Only fork-triggered runs use workflow_dispatch; skip push/pull_request runs entirely
if: github.event.workflow_run.event == 'workflow_dispatch'
# Only fork-triggered IT runs use workflow_dispatch; skip push/pull_request runs entirely
if: github.event.workflow_run.event == 'workflow_dispatch' && github.event.workflow_run.inputs.pr_ref != ''
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Get pr_ref from triggering run
id: inputs
run: |
pr_ref=$(gh run view ${{ github.event.workflow_run.id }} \
--repo "$GITHUB_REPOSITORY" --json inputs \
--jq '.inputs.pr_ref // empty')
echo "pr_ref=$pr_ref" >> $GITHUB_OUTPUT

- name: Post commit status per job
if: steps.inputs.outputs.pr_ref != ''
run: |
pr_ref="${{ steps.inputs.outputs.pr_ref }}"
pr_ref="${{ github.event.workflow_run.inputs.pr_ref }}"
gh run view ${{ github.event.workflow_run.id }} \
--repo "$GITHUB_REPOSITORY" --json jobs \
--jq '.jobs[] | [.name, .conclusion, .url] | @tsv' \
| while IFS=$'\t' read -r name conclusion url; do
case "$conclusion" in
success) state="success" ;;
cancelled) state="error" ;;
*) state="failure" ;;
success) state="success" ;;
cancelled|timed_out) state="error" ;;
skipped) continue ;;
*) state="failure" ;;
esac
gh api --method POST "repos/$GITHUB_REPOSITORY/statuses/$pr_ref" \
-f state="$state" \
-f context="$name" \
-f target_url="$url" \
-f description="$conclusion"
-f description="$conclusion" &
done
wait
Loading