Skip to content

Commit b9c4234

Browse files
Fix undefined exception by checking if artifact exists (#342)
* Fix undefined exception by checking if artifact exists * Update main.js * npm prepare --------- Co-authored-by: Zennon Gosalvez <1798166+zgosalvez@users.noreply.github.com>
1 parent 8affb40 commit b9c4234

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
2525
with:
2626
ref: ${{ github.head_ref }} # https://github.com/stefanzweifel/git-auto-commit-action#checkout-the-correct-branch
27+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2728
- name: Get runs.using version
2829
id: get-runs-using-version
2930
uses: zgosalvez/github-actions-get-action-runs-using-version@0a8dcac2c28bdcbfcbdca07d46bae8eab7930dc2

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ inputs:
3232
outputs:
3333
total-coverage:
3434
description: 'The total coverage from scanned files.'
35+
artifact-id:
36+
description: 'The GitHub artifact id for the generated HTML report.'
3537

3638
runs:
3739
using: 'node24'

dist/main/index.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ async function run() {
4646

4747
if (artifact) {
4848
body += `\n[Full coverage report](../actions/runs/${github.context.runId}/artifacts/${artifact.id})`;
49+
50+
core.setOutput('artifact-id', artifact.id);
4951
}
5052

5153
updateComment ? await upsertComment(body, commentHeaderPrefix, octokit) : await createComment(body, octokit);
@@ -58,7 +60,6 @@ async function run() {
5860
}
5961

6062
core.setOutput("total-coverage", totalCoverage);
61-
core.setOutput('artifact-id', artifact.id);
6263

6364
if (!isMinimumCoverageReached) {
6465
throw Error(errorMessage);

0 commit comments

Comments
 (0)