Skip to content

Commit

Permalink
Custom action
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-imx committed Nov 13, 2023
1 parent aa24d9e commit 0745e1a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
12 changes: 12 additions & 0 deletions .github/actions/coverage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: 'Publish coverage report'
description: 'Create or update PR comment with coverage report'

inputs:
coverage:
description: The coverage report to publish
required: true

runs:
using: 'node16'
main: 'index.js'
13 changes: 13 additions & 0 deletions .github/actions/coverage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const core = require('@actions/core');

const inputs = {
coverage: core.getInput('coverage'),
};


(async () => {
const { updateComment } = require("../utils/github");

await updateComment(inputs.coverage);
})();

8 changes: 2 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ jobs:
id: coverage

- name: Publish report
uses: actions/github-script@v6
uses: ./.github/actions/coverage
with:
script: |
const { updateComment } = require("./utils/github");
const report =
await updateComment(${{ steps.coverage.outputs.coverage }});
coverage: ${{ steps.coverage.outputs.coverage }}

0 comments on commit 0745e1a

Please sign in to comment.