forked from JBenda/inkcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (64 loc) · 2.25 KB
/
Copy pathpr-report.yml
File metadata and controls
69 lines (64 loc) · 2.25 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
name: PR Report
on:
workflow_run:
workflows: ["build"]
types: [completed]
jobs:
reporting:
name: "Pull Request Report"
# Only run for pull requests targeting master (not push/dispatch runs)
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.head_branch != 'master'
runs-on: ubuntu-latest
permissions:
pull-requests: write
actions: read
steps:
# Download Ink Proof Results from the triggering workflow run
- uses: actions/download-artifact@v4
with:
pattern: result-*
path: "results"
merge-multiple: true
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
# Retrieve the PR number from the workflow run
- name: Get PR number
id: get-pr
uses: actions/github-script@v7
with:
script: |
const prs = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: `${context.payload.workflow_run.head_repository.owner.login}:${context.payload.workflow_run.head_branch}`
});
if (prs.data.length === 0) {
core.setFailed('No matching open PR found');
return;
}
core.setOutput('pr_number', prs.data[0].number);
# Create comment text
- name: Create Comment Text File
shell: bash
run: |
echo "### Ink Proof Results" >> comment.txt
echo "" >> comment.txt
echo "These results are obtained by running the [Ink-Proof Testing Suite](https://github.com/chromy/ink-proof) on the compiled binaries in this pull request." >> comment.txt
echo "" >> comment.txt
echo "| System | Results |" >> comment.txt
echo "| --- | --- |" >> comment.txt
FILES="results/*.txt"
for f in $FILES
do
echo "Reading results from $f"
cat "$f" >> comment.txt
done
# Post Comment
- uses: marocchino/sticky-pull-request-comment@v2.9.0
with:
recreate: true
number: ${{ steps.get-pr.outputs.pr_number }}
path: comment.txt