Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 4 days ago
In general, to fix this problem you explicitly declare a
permissionsblock either at the root of the workflow (to apply to all jobs) or under the specific job that needs it. You grant only the minimal scopes required, commonly starting withcontents: readand then adding more granularwritescopes if needed. This ensures theGITHUB_TOKENis not implicitly granted broad default permissions.For this workflow, the safest, non‑breaking fix is to add a root‑level
permissionsblock just below thename:line and before theon:key. Since we don’t see any steps here and the logic lives in the referenced reusable workflow, a minimal and safe default iscontents: read, which is equivalent to a read‑only token for repository contents. If the reusable workflow requires more (for example,pull-requests: write), that can be added later in that workflow or by expanding this block, but addingcontents: readnow satisfies CodeQL and documents the intended least-privilege baseline without changing current behavior in most setups.Concretely:
.github/workflows/check-semantic-pr.yml.permissions:mapping after line 1 (name: Check Semantic PR).contents: readunderpermissions.No extra imports or external libraries are needed.