Update valitydev/java-workflow action to v4#76
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 1 day ago
In general, the fix is to explicitly add a permissions block to the workflow (or to the specific job) that grants only the minimal necessary permissions to GITHUB_TOKEN, instead of relying on repository defaults. For a typical Maven build that only needs to read source and possibly read packages, a safe minimal starting point is contents: read and optionally packages: read.
In this specific workflow, there is a single job build that delegates to a reusable workflow. The least intrusive and clearest fix is to add a root-level permissions block (between name: and on: or between on: and jobs:) so that it applies to all jobs, including the build job that calls the reusable workflow. Since we do not see any evidence that write permissions are needed, we will use the minimal recommended permissions: contents: read and packages: read. This documents the intended scope and restricts GITHUB_TOKEN appropriately without altering any existing build logic.
Concretely, edit .github/workflows/build.yml to insert:
permissions:
contents: read
packages: readnear the top of the file (e.g., after name: Maven Build Artifact). No imports or additional methods are needed, since this is pure workflow configuration.
| @@ -1,5 +1,9 @@ | ||
| name: Maven Build Artifact | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: 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.