Skip to content

Commit abd8055

Browse files
authored
Harden CI credentialed uploads (#78)
1 parent 3a202cb commit abd8055

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

.github/workflows/maven.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ jobs:
6060
verify:
6161
name: Maven Verify (JDK ${{ matrix.java }})
6262
runs-on: ubuntu-latest
63-
permissions:
64-
contents: read
65-
id-token: write
6663
strategy:
6764
fail-fast: false
6865
matrix:
@@ -97,8 +94,27 @@ jobs:
9794
path: target/site/jacoco
9895
if-no-files-found: warn
9996

97+
codecov:
98+
name: Upload coverage to Codecov
99+
if: github.event_name == 'push'
100+
runs-on: ubuntu-latest
101+
permissions:
102+
contents: read
103+
id-token: write
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
107+
with:
108+
persist-credentials: false
109+
- name: Set up JDK
110+
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
111+
with:
112+
distribution: temurin
113+
java-version: 21
114+
cache: maven
115+
- name: Build trusted coverage report
116+
run: mvn -B verify --file pom.xml
100117
- name: Upload coverage to Codecov
101-
if: matrix.java == '21'
102118
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
103119
with:
104120
files: target/site/jacoco/jacoco.xml

.github/workflows/quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
sonarcloud:
4949
name: SonarCloud analysis
50-
if: github.actor != 'dependabot[bot]'
50+
if: github.event_name == 'push' && github.actor != 'dependabot[bot]'
5151
runs-on: ubuntu-latest
5252
steps:
5353
- name: Checkout

0 commit comments

Comments
 (0)