Skip to content

Pull Request Comments #21

Pull Request Comments

Pull Request Comments #21

name: Pull Request Comments
on:
workflow_run:
workflows: [Pull Request]
types:
- completed
jobs:
download:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
permissions:
checks: write
contents: read
pull-requests: write
steps:
- name: 'Download artifact(s)'
uses: actions/github-script@v7
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchingArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == 'coverage-report';
});
const fs = require('fs');
for (matchingArtifact of matchingArtifacts) {
core.info(`Downloading ${matchingArtifact.name}.`);
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchingArtifact.id,
archive_format: 'zip',
});
fs.writeFileSync(`${{ github.workspace }}/${ matchingArtifact.name }.zip`, Buffer.from(download.data));
}
- name: 'Unzip artifact(s)'
run: unzip coverage-report.zip codeCoverageReport.xml
- name: Test Coverage Comment
uses: madrapps/jacoco-report@e4bbaf00a0b8920cb86a448ae3ec0fc6f6bfeacc
with:
paths: |
${{ github.workspace }}/codeCoverageReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 75
min-coverage-changed-files: 80