Skip to content

Commit

Permalink
only include summary in coverage comment on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
kedashoe committed Dec 8, 2023
1 parent 02d610e commit db19965
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,31 @@ jobs:
- name: Clean Install
run: npm ci

- name: Run Coverage
id: run-coverage
- name: Coverage Summary
id: coverage-summary
run: |
{
echo 'COVERAGE_OUTPUT<<EOF'
npm run coverage
echo 'COVERAGE_SUMMARY_OUTPUT<<EOF'
npm run coverage:summary
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Coverage Details
id: coverage-details
run: |
{
echo 'COVERAGE_DETAILS_OUTPUT<<EOF'
npm run coverage:details
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Log Coverage
env:
COVERAGE_OUTPUT: ${{ steps.run-coverage.outputs.COVERAGE_OUTPUT }}
run: echo "$COVERAGE_OUTPUT"
COVERAGE_SUMMARY_OUTPUT: ${{ steps.coverage-summary.outputs.COVERAGE_SUMMARY_OUTPUT }}
COVERAGE_DETAILS_OUTPUT: ${{ steps.coverage-details.outputs.COVERAGE_DETAILS_OUTPUT }}
run: |
echo "$COVERAGE_SUMMARY_OUTPUT"
echo "$COVERAGE_DETAILS_OUTPUT"
- name: Find Comment
uses: peter-evans/find-comment@v2
Expand All @@ -52,10 +64,10 @@ jobs:
issue-number: ${{ github.event.pull_request.number }}
body: |
<details>
<summary>Coverage Results</summary>
<summary>Coverage</summary>
```bash
${{ steps.run-coverage.outputs.COVERAGE_OUTPUT }}
${{ steps.coverage-summary.outputs.COVERAGE_SUMMARY_OUTPUT }}
```
</details>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
"partial-build": "node ./scripts/partialBuild",
"clean": "rimraf es/* src/* dist/* coverage/*",
"prepare": "npm run clean && npm run build",
"coverage": "BABEL_ENV=cjs nyc --reporter=text-summary --reporter=text mocha -- --reporter=min --require @babel/register",
"coverage:summary": "BABEL_ENV=cjs nyc --reporter=text-summary mocha -- --reporter=min --require @babel/register",
"coverage:details": "BABEL_ENV=cjs nyc --reporter=text mocha -- --reporter=min --require @babel/register",
"lint": "eslint scripts/bookmarklet scripts/*.js source/*.js source/internal/*.js test/*.js test/**/*.js lib/sauce/*.js lib/bench/*.js",
"browser_test": "testem ci",
"spec": "cross-env BABEL_ENV=cjs mocha --require @babel/register --reporter spec",
Expand Down

0 comments on commit db19965

Please sign in to comment.