Comment with API Coverage #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
const 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.` | |
}); |