Skip to content

Commit 5837440

Browse files
Merge pull request #489 from jdblischak/codecov-token
Use CODECOV_TOKEN to fix code coverage uploads
2 parents 3c094b0 + 2c2f57a commit 5837440

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

.github/workflows/test-coverage.yaml

+19-7
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
5-
branches: main
5+
branches: [main, master]
66
pull_request:
7-
branches: main
8-
workflow_dispatch:
97

10-
name: test-coverage
8+
name: test-coverage.yaml
9+
10+
permissions: read-all
1111

1212
jobs:
1313
test-coverage:
1414
runs-on: ubuntu-latest
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1517

1618
steps:
1719
- uses: actions/checkout@v4
@@ -22,23 +24,33 @@ jobs:
2224

2325
- uses: r-lib/actions/setup-r-dependencies@v2
2426
with:
25-
extra-packages: any::covr
27+
extra-packages: any::covr, any::xml2
2628
needs: coverage
2729

2830
- name: Test coverage
2931
run: |
30-
covr::codecov(
32+
cov <- covr::package_coverage(
3133
quiet = FALSE,
3234
clean = FALSE,
3335
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3436
)
37+
covr::to_cobertura(cov)
3538
shell: Rscript {0}
3639

40+
- uses: codecov/codecov-action@v4
41+
with:
42+
# Fail if error if not on PR, or if on PR and token is given
43+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
44+
file: ./cobertura.xml
45+
plugin: noop
46+
disable_search: true
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
3749
- name: Show testthat output
3850
if: always()
3951
run: |
4052
## --------------------------------------------------------------------
41-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
53+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
4254
shell: bash
4355

4456
- name: Upload test results

0 commit comments

Comments
 (0)