Skip to content

Fix the Maven release workflow and harden CI#606

Merged
NiccoMlt merged 11 commits into
diennea:masterfrom
NiccoMlt:fix-release-credential-split
Jun 18, 2026
Merged

Fix the Maven release workflow and harden CI#606
NiccoMlt merged 11 commits into
diennea:masterfrom
NiccoMlt:fix-release-credential-split

Conversation

@NiccoMlt

@NiccoMlt NiccoMlt commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Repairs the Maven release workflow so a release runs end-to-end (it previously failed at the deploy step) and cleans up how the release authenticates and attributes its commits.

How the release authenticates (the core change)

The release needs two different credentials, and one token can't cover both:

  • Git pushes to the protected master / release/* branches use a GitHub App token — it can bypass branch protection and attributes the release commits to a bot identity.
  • The Maven deploy and the GitHub Release use the Actions GITHUB_TOKEN. This is required: the GitHub Packages Maven registry rejects GitHub App tokens, so only a PAT or GITHUB_TOKEN authenticates there. Published artifacts and the release show as github-actions[bot].

Other release fixes

  • setup-java credentialsserver-username/server-password take environment-variable names, not values; the previous literal values resolved to an empty password and a 401 on deploy.
  • pom.xml SCM switched to the HTTPS URL with <tag>HEAD, so maven-release-plugin pushes over HTTPS (matching the token auth) instead of SSH.
  • Commit author set to diennea-bot; the shared Git identity + credential-helper setup is extracted into a local composite action (.github/actions/configure-git), defined once and reused by both checkouts.

Also in this PR (CI hygiene)

Pinned all external actions to commit SHAs, bumped test-reporter / upload-artifact / action-gh-release to their Node 24 majors, added a paths filter so PR validation skips non-code changes, and set persist-credentials: false on the read-only checkouts.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1340138d-e5f1-4423-a814-b566eaca6c24

📥 Commits

Reviewing files that changed from the base of the PR and between d78b0ab and 0ae1be4.

📒 Files selected for processing (2)
  • .github/workflows/master-snapshot.yml
  • .github/workflows/pr-validation.yml
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/pr-validation.yml
  • .github/workflows/master-snapshot.yml

📝 Walkthrough

Walkthrough

The release workflow is refactored to use GitHub App token authentication throughout its lifecycle. A new composite action (configure-git) is introduced to manage Git credential configuration and set commit identity. The workflow now generates a GitHub App token at the start, uses it for all authenticated operations (checkout, release:clean release:branch, and release:clean release:prepare), and configures Maven with GitHub server credentials via GITHUB_ACTOR/GITHUB_TOKEN. The final release publication step and GitHub Release creation action (upgraded from v2 to v3) explicitly use secrets.GITHUB_TOKEN. Across other workflows, GitHub Actions are pinned to specific commit SHAs for consistency and security: pr-validation.yml upgrades actions/upload-artifact from v4 to v7 and pins checkout/setup-java; pr-validation.yml adds a paths filter to restrict execution to relevant code directories and Maven files; pr-validation-report.yml upgrades dorny/test-reporter from v2 to v3; and master-snapshot.yml pins three action references to commit SHAs.

Poem

A token flows through workflows bright,
GitHub App guards the release flight, 🐰
Git identity stays fixed and true,
While paths and pins keep CI new,
Action versions pinned in place today!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

NiccoMlt added 4 commits June 17, 2026 18:09
* Add server credentials to release workflow

* Update GitHub Actions to use context variables
release:perform failed with 401 because setup-java was passed literal credential values where it expects environment-variable names, and because GitHub Packages does not accept GitHub App tokens. The Maven deploy and the GitHub release now authenticate with GITHUB_TOKEN, while the App token keeps doing the git pushes to the protected branches. Commits are authored as the diennea-bot machine user.
Bump test-reporter to v3 and upload-artifact to v7 (both move to the Node 24 runtime). Add a paths filter so PR validation runs only when module code, the parent pom, the Maven wrapper, or the PR validation workflow itself changes; PRs touching only docs or unrelated files no longer trigger a build.
@NiccoMlt NiccoMlt force-pushed the fix-release-credential-split branch from 0105bf2 to 6de3c89 Compare June 17, 2026 16:16
@NiccoMlt

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/pr-validation-report.yml (1)

16-16: Pin dorny/test-reporter to a full commit SHA.

Line 16 uses a mutable tag (@v3). Pinning to an immutable commit SHA reduces supply-chain risk. For v3.0.0, use a43b3a5f7366b97d083190328d2c652e1a8b6aa2.

Suggested patch
-      - uses: dorny/test-reporter@v3
+      - uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-validation-report.yml at line 16, The
`dorny/test-reporter` action uses a mutable tag `@v3` which creates a supply
chain risk since the tag can be modified. Replace the `@v3` tag in the
`dorny/test-reporter` action reference with the immutable commit SHA
`a43b3a5f7366b97d083190328d2c652e1a8b6aa2` to ensure the exact version is pinned
and cannot be changed unexpectedly.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-validation.yml:
- Around line 20-27: The paths filter in the pr-validation.yml workflow is
missing an entry for the pr-validation-report.yml file, allowing changes to that
report workflow to bypass validation. Add
'.github/workflows/pr-validation-report.yml' to the paths list at the same level
as the existing '.github/workflows/pr-validation.yml' entry to ensure PRs
modifying the report workflow trigger this validation chain.
- Line 62: Replace the mutable tag `@v7` with a pinned commit SHA in the
actions/upload-artifact action to prevent supply-chain attacks. Update both
instances (line 62 and line 70) of uses: actions/upload-artifact@v7 to uses:
actions/upload-artifact@043fb46c6418861d85040d828d546255799797c2 to pin to the
specific commit SHA for v7.0.1.

---

Nitpick comments:
In @.github/workflows/pr-validation-report.yml:
- Line 16: The `dorny/test-reporter` action uses a mutable tag `@v3` which
creates a supply chain risk since the tag can be modified. Replace the `@v3` tag
in the `dorny/test-reporter` action reference with the immutable commit SHA
`a43b3a5f7366b97d083190328d2c652e1a8b6aa2` to ensure the exact version is pinned
and cannot be changed unexpectedly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2dd730f8-345f-4968-a097-a6e8354f8f37

📥 Commits

Reviewing files that changed from the base of the PR and between 436bd18 and 6de3c89.

📒 Files selected for processing (3)
  • .github/workflows/pr-validation-report.yml
  • .github/workflows/pr-validation.yml
  • .github/workflows/release.yml

Comment thread .github/workflows/pr-validation.yml
Comment thread .github/workflows/pr-validation.yml Outdated
NiccoMlt added 3 commits June 17, 2026 18:25
The diennea-bot identity and gh credential-helper setup were duplicated across the Configure Git and Reconfigure Git steps. Move them into a local composite action so the bot identity lives in one place; behaviour is unchanged.
Supply-chain hardening for the two third-party actions bumped in this PR, pinned to their v7.0.1 and v3.0.0 commits with a version comment. The reviewer-suggested upload-artifact SHA did not exist; used the verified v7.0.1 commit instead.
Pin the rest of the external actions (checkout, setup-java, create-github-app-token, action-gh-release, maven-dependency-submission-action) to their release commit SHAs, consistent with the already-pinned upload-artifact and test-reporter. Also add pr-validation-report.yml to the PR validation paths so changes to either CI workflow trigger validation.
@NiccoMlt

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/pr-validation.yml (1)

54-54: 💤 Low value

Consider adding persist-credentials: false for defense-in-depth.

While this workflow only has read permissions and doesn't perform any authenticated Git operations after checkout, adding persist-credentials: false would align with security best practices and the pattern used in release.yml.

Suggested change
-      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
+      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
+        with:
+          persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-validation.yml at line 54, The actions/checkout action
in the pr-validation.yml workflow is missing the persist-credentials
configuration parameter. Add persist-credentials: false as a with parameter to
the checkout action to align with security best practices and match the pattern
used in release.yml. This prevents credentials from persisting after checkout
even though the workflow has read-only permissions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/master-snapshot.yml:
- Line 13: The actions/checkout action on line 13 of the master-snapshot.yml
workflow is using default credential persistence settings, which unnecessarily
exposes the GITHUB_TOKEN to later steps. Add the `persist-credentials: false`
option to the checkout action configuration since this job does not perform
authenticated git writes and does not need credential persistence enabled.

---

Nitpick comments:
In @.github/workflows/pr-validation.yml:
- Line 54: The actions/checkout action in the pr-validation.yml workflow is
missing the persist-credentials configuration parameter. Add
persist-credentials: false as a with parameter to the checkout action to align
with security best practices and match the pattern used in release.yml. This
prevents credentials from persisting after checkout even though the workflow has
read-only permissions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9292dd53-e87b-4410-af28-a33848d30434

📥 Commits

Reviewing files that changed from the base of the PR and between 6de3c89 and d78b0ab.

📒 Files selected for processing (5)
  • .github/actions/configure-git/action.yml
  • .github/workflows/master-snapshot.yml
  • .github/workflows/pr-validation-report.yml
  • .github/workflows/pr-validation.yml
  • .github/workflows/release.yml
✅ Files skipped from review due to trivial changes (1)
  • .github/actions/configure-git/action.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pr-validation-report.yml

Comment thread .github/workflows/master-snapshot.yml
The master-snapshot and pr-validation jobs do no authenticated git writes, so set persist-credentials: false on their checkouts to avoid leaving the token in the local git config, matching release.yml.
@NiccoMlt NiccoMlt changed the title Fix release deploy: use GITHUB_TOKEN for Maven and GitHub release Fix the Maven release workflow and harden CI Jun 18, 2026
@NiccoMlt NiccoMlt merged commit a6b6585 into diennea:master Jun 18, 2026
2 checks passed
@NiccoMlt NiccoMlt deleted the fix-release-credential-split branch June 18, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants