Workflow file for this run
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
<<<<<<< HEAD | ||
# 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' |