Skip to content

Commit 2baa5ed

Browse files
committed
CI: use Codecov OIDC on master
Upload coverage only on master and authenticate via OIDC (no CODECOV_TOKEN secret required).
1 parent ccab3c2 commit 2baa5ed

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/drupal-module.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
phpunit:
2121
runs-on: ubuntu-latest
2222
continue-on-error: ${{ matrix.experimental }}
23+
permissions:
24+
contents: read
25+
id-token: write
2326
strategy:
2427
fail-fast: false
2528
matrix:
@@ -85,32 +88,33 @@ jobs:
8588
chmod -R 777 drupal/web/sites/simpletest/browser_output
8689
8790
- name: Run PHPUnit
88-
if: ${{ !matrix.coverage }}
91+
if: ${{ !matrix.coverage || github.ref != 'refs/heads/master' }}
8992
run: |
9093
cd drupal/web
9194
../vendor/bin/phpunit -c core modules/contrib/jsonapi_frontend_layout/tests
9295
9396
- name: Run PHPUnit (coverage)
94-
if: ${{ matrix.coverage }}
97+
if: ${{ matrix.coverage && github.ref == 'refs/heads/master' }}
9598
run: |
9699
cd drupal/web
97100
../vendor/bin/phpunit -c core modules/contrib/jsonapi_frontend_layout/tests \
98101
--coverage-clover "$GITHUB_WORKSPACE/coverage.xml" \
99102
--coverage-filter modules/contrib/jsonapi_frontend_layout
100103
101104
- name: Upload coverage artifact
102-
if: ${{ matrix.coverage }}
105+
if: ${{ matrix.coverage && github.ref == 'refs/heads/master' }}
103106
uses: actions/upload-artifact@v4
104107
with:
105108
name: coverage-jsonapi_frontend_layout
106109
path: coverage.xml
107110
if-no-files-found: error
108111

109112
- name: Upload coverage to Codecov
110-
if: ${{ matrix.coverage }}
113+
if: ${{ matrix.coverage && github.ref == 'refs/heads/master' }}
111114
continue-on-error: true
112115
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
113116
with:
117+
use_oidc: true
114118
files: coverage.xml
115119
flags: phpunit,drupal
116120
fail_ci_if_error: false

0 commit comments

Comments
 (0)