Skip to content

Commit da11f25

Browse files
Copilotneilime
andcommitted
Fix github-token handling in test action and update documentation
Co-authored-by: neilime <314088+neilime@users.noreply.github.com>
1 parent fcc57ee commit da11f25

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,3 +375,4 @@ jobs:
375375
working-directory: ${{ inputs.working-directory }}
376376
container: ${{ inputs.container != '' }}
377377
coverage: ${{ inputs.coverage }}
378+
github-token: ${{ github.token }}

actions/lint/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ runs:
7373
exit 0
7474
7575
- shell: bash
76-
if: inputs.report-file != '' && hashFiles(inputs.report-file) != ''
76+
if: inputs.report-file != ''
7777
working-directory: ${{ inputs.working-directory }}
7878
env:
7979
REPORT_FILE: ${{ inputs.report-file }}

actions/test/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Composite action to test Node.js projects with support for coverage reporting, p
3535
# Default: ""
3636
codecov-token: ${{ secrets.CODECOV_TOKEN }}
3737

38+
# GitHub token (required for "lcov" coverage PR comments)
39+
# Default: ""
40+
github-token: ${{ github.token }}
41+
3842
# Whether to fail the action if tests fail
3943
# Default: "true"
4044
fail-on-error: "true"
@@ -49,6 +53,7 @@ Composite action to test Node.js projects with support for coverage reporting, p
4953
| `coverage` | Code coverage reporter: "Codecov", "lcov", or "" | No | `""` |
5054
| `lcov-file` | Path to LCOV file for coverage reporting (used with "lcov" coverage) | No | `coverage/lcov.info` |
5155
| `codecov-token` | Codecov token for private repositories | No | `""` |
56+
| `github-token` | GitHub token for LCOV reporter PR comments | No | `""` |
5257
| `fail-on-error` | Whether to fail the action if tests fail | No | `true` |
5358

5459
## Outputs
@@ -107,6 +112,7 @@ This will post coverage reports as PR comments.
107112
with:
108113
coverage: "lcov"
109114
lcov-file: "coverage/lcov.info"
115+
github-token: ${{ github.token }}
110116
```
111117

112118
### Test in a specific directory

actions/test/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ inputs:
3636
Not required for public repositories when using OIDC.
3737
required: false
3838
default: ""
39+
github-token:
40+
description: |
41+
GitHub token for LCOV reporter PR comments.
42+
Required when coverage is set to "lcov".
43+
required: false
44+
default: ""
3945
fail-on-error:
4046
description: "Whether to fail the action if tests fail"
4147
required: false
@@ -126,7 +132,7 @@ runs:
126132
coverage-files: ${{ inputs.working-directory }}/${{ inputs.lcov-file }}
127133
minimum-coverage: 0
128134
artifact-name: coverage-report
129-
github-token: ${{ github.token }}
135+
github-token: ${{ inputs.github-token }}
130136
update-comment: true
131137
working-directory: ${{ inputs.working-directory }}
132138

0 commit comments

Comments
 (0)