Update valitydev/java-workflow action to v4#61
Conversation
| jobs: | ||
| build: | ||
| uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v3 | ||
| uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v4 |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 19 days ago
In general, the fix is to explicitly specify a minimal permissions block so that the GITHUB_TOKEN used by this workflow is restricted according to the principle of least privilege. This can be done at the workflow root (applies to all jobs) or per job. Since this workflow contains only a single job, adding permissions at the root is the simplest and most self‑documenting fix.
The best way to fix this specific file without changing existing functionality is to add a permissions block near the top of the workflow, alongside name: and on:. Because we don’t see any direct token usage in this file (the logic lives in the reusable workflow), a safe, minimal starting point is to grant read access to repository contents only, which matches GitHub’s recommended baseline: permissions: { contents: read }. If the reusable workflow requires additional scopes (e.g., to write to PRs), they can be added later, but starting with contents: read satisfies CodeQL’s requirement and enforces least privilege by default.
Concretely, in .github/workflows/build.yml, insert:
permissions:
contents: readbetween name: Maven Build Artifact and the on: block (lines 1–3). No imports or additional methods are needed, since this is purely a YAML configuration change.
| @@ -1,5 +1,8 @@ | ||
| name: Maven Build Artifact | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: |
This PR contains the following updates:
v3→v4Release Notes
valitydev/java-workflow (valitydev/java-workflow)
v4Compare Source
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.