-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #416 from rewiringamerica/develop
Fix CI workflow for PRs from other forks
- Loading branch information
Showing
2 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Coverage report | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["BuildStockBatch Tests"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
coverage: | ||
name: Post coverage report to PR | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.event == 'pull_request' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.workflow_run.head_commit.id }} | ||
|
||
- name: Download Coverage Artifacts | ||
uses: Legit-Labs/action-download-artifact@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: ${{ github.event.workflow_run.workflow_id }} | ||
workflow_conclusion: success | ||
commit: ${{ github.event.workflow_run.head_commit.id }} | ||
name: coverage-report-xml | ||
path: buildstockbatch/coverage | ||
|
||
# This step is here instead of in ci.yml because PRs from other forks | ||
# do not have write permission to the PR during a pull_request action. | ||
# More information: | ||
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | ||
# Example to follow: | ||
# https://github.com/5monkeys/cobertura-action/tree/master/.github/workflows | ||
- name: Report coverage to PR | ||
uses: 5monkeys/cobertura-action@v13 | ||
with: | ||
path: buildstockbatch/coverage/coverage.xml | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
minimum_coverage: 33 | ||
fail_below_threshold: true |