fix: ensure vulnerability-alerts permission compiles correctly in dependabot-go-checker#28305
fix: ensure vulnerability-alerts permission compiles correctly in dependabot-go-checker#28305
Conversation
…ed YAML
The GitHub Actions engine rejects `vulnerability-alerts: read` when it
appears in a job-level permissions block. It must be declared at the
workflow level.
Changes:
- Add `GetWorkflowOnlyPermissionScopes()` and `IsWorkflowOnlyPermissionScope()`
to identify permissions that can only be used at the workflow level
- Add `Delete()` method to `Permissions` struct
- Modify `filterJobLevelPermissions()` to strip workflow-only scopes from
job-level permissions blocks
- Add `buildWorkflowLevelPermissions()` to generate a workflow-level
permissions block that includes workflow-only scopes
- Modify `generateWorkflowBody()` to use `buildWorkflowLevelPermissions()`
instead of always writing `permissions: {}`
- Update tests to reflect new behavior
- Recompile dependabot-go-checker.lock.yml with fix applied
Fixes: vulnerability-alerts: read permission not allowed at job level
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/acbdaa27-6741-4f27-b710-dfefd460df44
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot fix the github actions json schema to also support vulnerability alerts at the job level and keep the permissions at the job level. |
…ts it The GitHub Actions JSON schema (main_workflow_schema.json) already includes vulnerability-alerts in github_actions_permissions with additionalProperties:false, so the permission is valid at the job level. Revert the previous approach of moving it to workflow level and keep vulnerability-alerts: read in the agent job permissions block where it belongs. Recompile dependabot-go-checker.lock.yml accordingly. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/79ffb5f7-2910-4153-a0ba-52d4378eec1d Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in 3229fdb. The |
|
Hey One thing that would help get this across the finish line:
If you'd like a hand, you can assign this prompt to your coding agent:
|
The
dependabot-go-checkerworkflow was failing to compile because thevulnerability-alerts: readpermission was not recognised by the gh-aw JSON schema at the job level.Changes
pkg/parser/schemas/main_workflow_schema.jsonalready includedvulnerability-alertsin$defs/github_actions_permissions(withadditionalProperties: false), making it valid at the job level. No schema change was required — the existing schema correctly supports this permission.dependabot-go-checker.lock.ymlrecompiled —vulnerability-alerts: readremains in the agent job-level permissions block where it belongs.