Skip to content

Post coverage comment #562

Post coverage comment

Post coverage comment #562

Workflow file for this run

name: Post coverage comment
on:
workflow_run:
workflows: ["Testing"]
types:
- completed
jobs:
test:
name: Run tests & display coverage
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
actions: read
steps:
- name: Check if should run
id: check
run: |
if [[ "${{ github.event.workflow_run.event }}" == "pull_request" ]] && [[ "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
echo "✅ Running coverage comment for PR"
else
echo "should_run=false" >> $GITHUB_OUTPUT
echo "✅ Skipping - not a PR event (event: ${{ github.event.workflow_run.event }})"
fi
- name: Post comment
if: steps.check.outputs.should_run == 'true'
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}