-
Notifications
You must be signed in to change notification settings - Fork 7
57 lines (50 loc) · 1.91 KB
/
pull_request_comment.yml
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
name: Comment on Pull Request
on:
workflow_run:
workflows: [Data Tests (Changed Files)]
types:
- completed
jobs:
comment:
name: Comment on pull request
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure'
strategy:
fail-fast: false
matrix:
test: [duplicate_entries, file_format, missing_values, vote_breakdown_totals]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
- name: Read pull request number
id: pull_request_number_reader
uses: juliangruber/read-file-action@v1
with:
path: ./pull_request_number/pull_request_number.txt
- name: Check for failures
id: check_failures
uses: andstor/file-existence-action@v3
with:
files: ./${{ matrix.test }}/${{ matrix.test }}.txt
- name: Read failure logs
if: steps.check_failures.outputs.files_exists == 'true'
id: failure_reader
uses: juliangruber/read-file-action@v1
with:
path: ./${{ matrix.test }}/${{ matrix.test }}.txt
- name: Comment on pull request
if: steps.check_failures.outputs.files_exists == 'true'
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ steps.pull_request_number_reader.outputs.content }},
body: `Thank you for your contribution! Our <code>${{ matrix.test }}</code> `+
`test detected some potential issues in the files you added.\n\n`+
`<pre><code>${{ steps.failure_reader.outputs.content }}</code></pre>`
});