Comment on PR #4
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 on PR | |
# following example: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | |
on: | |
workflow_run: | |
workflows: ["Unit tests"] | |
types: | |
- completed | |
jobs: | |
report-coverage: | |
if: > | |
github.event.workflow_run.event == 'pull_request' && | |
github.event.workflow_run.conclusion == 'success' | |
runs-on: [self-hosted, linux, x64, gpu] | |
container: | |
image: ubuntu | |
permissions: | |
# Allow publishing new comments on PRs | |
pull-requests: write | |
# Allow for editing existing comments | |
contents: write | |
# Read the action that triggered this one | |
actions: read | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
run-id: ${{ github.event.workflow_run.id}} | |
- name: get PR | |
id: get-pr | |
run: echo "PR=$(cat coverage.PR)" >> "$GITHUB_OUTPUT" | |
- name: Get Coverage | |
uses: 5monkeys/cobertura-action@master | |
with: | |
path: coverage.xml | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
pull_request_number: ${{ steps.get-pr.outputs.PR }} |