Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/workflow/permissions_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ func filterJobLevelPermissions(rawPermissionsYAML string) string {
filtered := NewPermissionsParser(rawPermissionsYAML).ToPermissions()
rendered := filtered.RenderToYAML()
if rendered == "" {
// If the raw permissions YAML was an explicit empty block (permissions: {}), preserve
// it at the job level. Without this check, "permissions: {}" would be silently dropped,
// leaving the job without any permissions block and causing it to inherit the workflow-
// level permissions instead of having its own explicit empty block.
if strings.TrimSpace(rawPermissionsYAML) == "permissions: {}" {
return "permissions: {}"
}
return ""
}

Expand Down
Loading