Skip to content

Commit

Permalink
Working through code coverage from forks (#125)
Browse files Browse the repository at this point in the history
* Working through build issues for new contributors

* Adding retention period to artifacts
  • Loading branch information
sadukie committed Mar 21, 2023
1 parent 3aa4379 commit 6384038
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/comment-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Comment on the Pull Request

# read-write repo token
# See: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
on:
workflow_run:
workflows: [".NET Core"]
types:
- completed

jobs:
comment:
runs-on: ubuntu-latest

# Only comment on the PR if this is a PR event
if: github.event.workflow_run.event == 'pull_request'

steps:
- name: Get the PR Number artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: ""
name: pr-number
- name: Read PR Number into GitHub environment variables
run: echo "PR_NUMBER=$(cat pr-number.txt)" >> $GITHUB_ENV
- name: Confirm the PR Number (Debugging)
run: echo $PR_NUMBER
- name: Get the code coverage results file
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: ""
name: code-coverage-results
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ env.PR_NUMBER }}
recreate: true
path: code-coverage-results.md
24 changes: 20 additions & 4 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,25 @@ jobs:
format: 'markdown'
output: 'both'

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
- name: Upload code coverage results artifact
uses: actions/upload-artifact@v3
if: success() || failure()
with:
recreate: true
name: code-coverage-results
path: code-coverage-results.md
retention-days: 1

- name: Save the PR number in an artifact
if: github.event_name == 'pull_request' && (success() || failure())
shell: bash
env:
PR_NUMBER: ${{ github.event.number }}
run: echo $PR_NUMBER > pr-number.txt

- name: Upload the PR number
uses: actions/upload-artifact@v3
if: github.event_name == 'pull_request' && (success() || failure())
with:
name: pr-number
path: ./pr-number.txt
retention-days: 1

0 comments on commit 6384038

Please sign in to comment.