Comment on PR #12
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 | |
# DEBUG to make sure the action can pass at all | |
permissions: write-all | |
# 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 | |
# Allow to write check runs | |
# checks: read | |
# Allow to check commit statusses | |
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 }} | |
minimum_coverage: 75 | |
show_missing: True | |
fail_below_threshold: True | |
# False for now, might set to true later | |
only_changed_files: False |