From de291d678bade55a8f312f8c5a810d2ffffbcef0 Mon Sep 17 00:00:00 2001 From: Justin Kulikauskas <44813129+JustinKuli@users.noreply.github.com> Date: Sun, 5 May 2024 02:03:29 +0000 Subject: [PATCH] Add code coverage comment to PRs Signed-off-by: Justin Kulikauskas <44813129+JustinKuli@users.noreply.github.com> --- .github/workflows/code_cov_comment.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/code_cov_comment.yaml diff --git a/.github/workflows/code_cov_comment.yaml b/.github/workflows/code_cov_comment.yaml new file mode 100644 index 0000000..e5c6bec --- /dev/null +++ b/.github/workflows/code_cov_comment.yaml @@ -0,0 +1,23 @@ +name: Code Coverage Comment + +on: + pull_request: + types: [opened, reopened] + +jobs: + comment: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const branchName = '${{ github.head_ref }}' + const repo = 'JustinKuli/governance-policy-nucleus' + const badgePath = 'https://github.com/' + repo + '/wiki/' + branchName + '/coverage.svg' + const reportPath = 'https://raw.githack.com/wiki/' + repo + '/' + branchName + '/coverage.html' + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Code Coverage Report for this branch (might be slow to update): [![Go Coverage](' + badgePath + ')](' + reportPath + ')' + })