-
Notifications
You must be signed in to change notification settings - Fork 592
Expand file tree
/
Copy pathbuild-test-debug-pr-comment.yml
More file actions
78 lines (68 loc) · 2.57 KB
/
Copy pathbuild-test-debug-pr-comment.yml
File metadata and controls
78 lines (68 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Publish Test Report
# Second half of build-test-debug
# see https://github.com/ctrf-io/github-test-reporter/blob/main/docs/fork-pull-requests.md
on:
workflow_run:
workflows: [ 'Build & Test Debug' ]
types: [ completed ]
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_sha }}
cancel-in-progress: true
jobs:
report:
name: Comment Test Results
if: >-
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion != 'cancelled' &&
github.event.workflow_run.conclusion != 'skipped'
runs-on: ubuntu-slim
permissions:
actions: read
contents: read
pull-requests: write
steps:
- name: Download CTRF test results
continue-on-error: true
uses: actions/download-artifact@v8
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
pattern: test-nunit-*
path: /tmp/ctrf-results
- name: Determine PR number
id: pr
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
PR_NUM=$(gh api "repos/${GH_REPO}/commits/${HEAD_SHA}/pulls" \
--jq "[.[] | select(.state == \"open\" and .head.sha == \"${HEAD_SHA}\") | .number] | first // empty" || true)
if [ -z "$PR_NUM" ]; then
PR_NUM=$(gh pr list --state open --limit 100 --json number,headRefOid \
--jq "[.[] | select(.headRefOid == \"${HEAD_SHA}\") | .number] | first // empty" || true)
fi
if [ -z "$PR_NUM" ]; then
echo "No open PR found for head SHA ${HEAD_SHA}; skipping comment"
else
echo "Commenting on PR #${PR_NUM}"
fi
echo "number=${PR_NUM}" >> "$GITHUB_OUTPUT"
- name: Comment test results on PR
if: ${{ steps.pr.outputs.number != '' }}
uses: ctrf-io/github-test-reporter@v1
with:
report-path: '/tmp/ctrf-results/**/*.json'
title: Content + Integration Test Results
community-report: true
community-report-name: summary-short
failed-folded-report: true
issue: ${{ steps.pr.outputs.number }}
overwrite-comment: true
comment-tag: debug-ci-test-report
exit-on-no-files: false
exit-on-fail: false
report-order: 'summary-short,failed-folded-report'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}