From 0265f0e49869a7088ea66762190435169c1af32c Mon Sep 17 00:00:00 2001 From: Michael St Clair Date: Mon, 17 Jul 2023 20:31:46 -0400 Subject: [PATCH] setup outputs (#15) * setup outputs * update setup-node * format --- .github/workflows/check-dist.yml | 2 +- README.md | 8 ++++++++ dist/index.js | 3 +++ src/main.ts | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index e35f3ea..61a2455 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - name: Set Node.js 16.x - uses: actions/setup-node@v3.6.0 + uses: actions/setup-node@v3 with: node-version: 16.x diff --git a/README.md b/README.md index 542b563..5d6942f 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,14 @@ jobs: - `github_token`: (Required) Access from `${{ secrets.GITHUB_TOKEN }}` +## Outputs + +- `covered`: Number of lines covered. + +- `relevant`: Number of lines considered relevant. + +- `percentage`: The coverage percentage. + ## Add the coverage badge to your README.md ```markdown diff --git a/dist/index.js b/dist/index.js index b2ed272..4856b7f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11754,6 +11754,9 @@ function run() { // changedFiles only currently supported for PRs const changedFiles = github.context.eventName === "pull_request" ? yield (0, changed_files_1.getChangedFiles)(octokit) : {}; const { covered, coveredForPatch, relevant, relevantForPatch, percentage, patchPercentage, annotations } = yield (0, parse_1.parse)(format, file, changedFiles, subdirectory); + core.setOutput("covered", covered); + core.setOutput("relevant", relevant); + core.setOutput("percentage", percentage); const payload = { covered, relevant, diff --git a/src/main.ts b/src/main.ts index 3e806ea..ace4741 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,6 +26,10 @@ async function run(): Promise { const { covered, coveredForPatch, relevant, relevantForPatch, percentage, patchPercentage, annotations } = await parse(format, file, changedFiles, subdirectory) + core.setOutput("covered", covered) + core.setOutput("relevant", relevant) + core.setOutput("percentage", percentage) + const payload = { covered, relevant,