Skip to content

Commit 02ac390

Browse files
committed
set up tokenless OIDC in CI
1 parent 3c0ac5e commit 02ac390

19 files changed

+45
-21
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
test:
1111
name: Test
1212
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
id-token: write
1316
strategy:
1417
matrix:
1518
node-version: [18.x, 20.x]
@@ -39,15 +42,37 @@ jobs:
3942
- name: Run tests
4043
run: npm run test:coverage
4144

42-
- name: Upload coverage to Codecov
45+
# 🔹 Always upload the coverage folder so you can inspect reports from CI runs
46+
- name: Upload coverage artifact
47+
if: always()
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: coverage-${{ matrix.node-version }}
51+
path: coverage/
52+
retention-days: 7
53+
54+
# 🔹 Codecov upload using OIDC (skips forked PRs)
55+
- name: Upload coverage to Codecov (OIDC)
56+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
4357
uses: codecov/codecov-action@v5
4458
with:
45-
token: ${{ secrets.CODECOV_TOKEN }} # or set `use_oidc: true` + permissions
59+
use_oidc: true
4660
files: ./coverage/lcov.info
4761
flags: unittests
4862
name: codecov-umbrella
4963
fail_ci_if_error: true
5064

65+
# 🔹 Best-effort Codecov on forked PRs (won't fail CI if upload is blocked)
66+
- name: Upload coverage to Codecov (best-effort on forks)
67+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
68+
uses: codecov/codecov-action@v5
69+
with:
70+
use_oidc: true
71+
files: ./coverage/lcov.info
72+
flags: unittests
73+
name: codecov-umbrella
74+
fail_ci_if_error: false
75+
5176
build:
5277
name: Build
5378
runs-on: ubuntu-latest
@@ -142,4 +167,3 @@ jobs:
142167
- name: Run dependency check
143168
if: github.event_name == 'pull_request'
144169
uses: actions/dependency-review-action@v4
145-

coverage/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ <h1>All files</h1>
116116
<div class='footer quiet pad2 space-top1 center small'>
117117
Code coverage generated by
118118
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119-
at 2025-09-05T16:54:56.690Z
119+
at 2025-09-05T17:41:46.581Z
120120
</div>
121121
<script src="prettify.js"></script>
122122
<script>

coverage/lcov-report/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ <h1>All files</h1>
116116
<div class='footer quiet pad2 space-top1 center small'>
117117
Code coverage generated by
118118
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119-
at 2025-09-05T16:54:56.681Z
119+
at 2025-09-05T17:41:46.570Z
120120
</div>
121121
<script src="prettify.js"></script>
122122
<script>

coverage/lcov-report/tools/calculator.ts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">tools</a> calcu
430430
<div class='footer quiet pad2 space-top1 center small'>
431431
Code coverage generated by
432432
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
433-
at 2025-09-05T16:54:56.681Z
433+
at 2025-09-05T17:41:46.570Z
434434
</div>
435435
<script src="../prettify.js"></script>
436436
<script>

coverage/lcov-report/tools/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ <h1><a href="../index.html">All files</a> tools</h1>
131131
<div class='footer quiet pad2 space-top1 center small'>
132132
Code coverage generated by
133133
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
134-
at 2025-09-05T16:54:56.681Z
134+
at 2025-09-05T17:41:46.570Z
135135
</div>
136136
<script src="../prettify.js"></script>
137137
<script>

coverage/lcov-report/tools/setup.ts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">tools</a> setup
241241
<div class='footer quiet pad2 space-top1 center small'>
242242
Code coverage generated by
243243
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
244-
at 2025-09-05T16:54:56.681Z
244+
at 2025-09-05T17:41:46.570Z
245245
</div>
246246
<script src="../prettify.js"></script>
247247
<script>

coverage/lcov-report/tools/text-processing.ts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">tools</a> text-
841841
<div class='footer quiet pad2 space-top1 center small'>
842842
Code coverage generated by
843843
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
844-
at 2025-09-05T16:54:56.681Z
844+
at 2025-09-05T17:41:46.570Z
845845
</div>
846846
<script src="../prettify.js"></script>
847847
<script>

coverage/lcov-report/utils/config.ts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">utils</a> confi
340340
<div class='footer quiet pad2 space-top1 center small'>
341341
Code coverage generated by
342342
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
343-
at 2025-09-05T16:54:56.681Z
343+
at 2025-09-05T17:41:46.570Z
344344
</div>
345345
<script src="../prettify.js"></script>
346346
<script>

coverage/lcov-report/utils/errors.ts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">utils</a> error
601601
<div class='footer quiet pad2 space-top1 center small'>
602602
Code coverage generated by
603603
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
604-
at 2025-09-05T16:54:56.681Z
604+
at 2025-09-05T17:41:46.570Z
605605
</div>
606606
<script src="../prettify.js"></script>
607607
<script>

coverage/lcov-report/utils/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ <h1><a href="../index.html">All files</a> utils</h1>
131131
<div class='footer quiet pad2 space-top1 center small'>
132132
Code coverage generated by
133133
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
134-
at 2025-09-05T16:54:56.681Z
134+
at 2025-09-05T17:41:46.570Z
135135
</div>
136136
<script src="../prettify.js"></script>
137137
<script>

0 commit comments

Comments
 (0)