-
Notifications
You must be signed in to change notification settings - Fork 62
36 lines (33 loc) · 1.09 KB
/
coverage-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
name: Comment with API Coverage
on:
workflow_run:
workflows: ["Gather API Coverage"]
types:
- completed
jobs:
comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Download Coverage Report
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
name: coverage
run-id: ${{ github.event.workflow_run.id }}
- name: 'Comment on PR'
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
var data = JSON.parse(fs.readFileSync('./coverage.json'));
console.log(data);
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: data.pull_request,
body: `API specs implemented for ${data.current}/${data.total} (${data.percent}%) APIs.`
});