Skip to content
<<<<<<< HEAD

Check failure on line 1 in .github/workflows/comment_coverage_report.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/comment_coverage_report.yml

Invalid workflow file

You have an error in your yaml syntax on line 1
# Contains jobs corresponding to publishing coverage reports generated by code_coverage.yml.
name: Comment Coverage Report
on:
workflow_run:
workflows: ["Code Coverage"] # This must exactly match the name in code_coverage.yml
types:
- completed
permissions:
pull-requests: write
actions: read
jobs:
comment_coverage_report:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'cancelled'
steps:
- name: Download Coverage Report
uses: dawidd6/action-download-artifact@v3
with:
workflow: Code Coverage
name: final-coverage-report
run_id: ${{ github.event.workflow_run.id }}
- name: Get PR Number
uses: actions/github-script@v7
id: find-pr
with:
script: |
const { owner, repo } = context.repo;
const { head_sha } = context.payload.workflow_run;
// Search for PR associated with this commit
const result = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner,
repo,
commit_sha: head_sha
});
if (result.data.length === 0) {
console.log('No PR found for this commit');
return;
}
// Get the PR number
const prNumber = result.data[0].number;
core.setOutput('pr_number', prNumber);
core.setOutput('found', 'true');
- name: Comment Coverage Report
if: steps.find-pr.outputs.found == 'true'
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.find-pr.outputs.pr_number }}
body-file: 'CoverageReport.md'