Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 1 addition & 7 deletions pkg/workflow/compiler_activation_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"maps"
"slices"
"sort"
"strconv"
"strings"

Expand Down Expand Up @@ -802,12 +801,7 @@ func (c *Compiler) buildMainJob(data *WorkflowData, activationJobCreated bool) (
// so the agent job gets them transitively through activation
// Custom jobs that depend on agent should run AFTER the agent job, not before it
if data.Jobs != nil {
jobNames := make([]string, 0, len(data.Jobs))
for jobName := range data.Jobs {
jobNames = append(jobNames, jobName)
}
sort.Strings(jobNames)
for _, jobName := range jobNames {
for _, jobName := range slices.Sorted(maps.Keys(data.Jobs)) {
// Skip jobs.pre-activation (or pre_activation) as it's handled specially
if jobName == string(constants.PreActivationJobName) || jobName == "pre-activation" {
continue
Expand Down
85 changes: 40 additions & 45 deletions pkg/workflow/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,48 @@ var permissionsLog = logger.New("workflow:permissions")

// convertStringToPermissionScope converts a string key to a PermissionScope
func convertStringToPermissionScope(key string) PermissionScope {
scope := func() PermissionScope {
switch key {
case "actions":
return PermissionActions
case "attestations":
return PermissionAttestations
case "checks":
return PermissionChecks
case "contents":
return PermissionContents
case "deployments":
return PermissionDeployments
case "discussions":
return PermissionDiscussions
case "id-token":
return PermissionIdToken
case "issues":
return PermissionIssues
case "metadata":
return PermissionMetadata
case "models":
return PermissionModels
case "packages":
return PermissionPackages
case "pages":
return PermissionPages
case "pull-requests":
return PermissionPullRequests
case "repository-projects":
return PermissionRepositoryProj
case "organization-projects":
return PermissionOrganizationProj
case "security-events":
return PermissionSecurityEvents
case "statuses":
return PermissionStatuses
case "all":
// "all" is a meta-key handled at the parser level; it is not a real scope
return ""
default:
return ""
}
}()
if scope == "" && key != "all" {
switch key {
case "actions":
return PermissionActions
case "attestations":
return PermissionAttestations
case "checks":
return PermissionChecks
case "contents":
return PermissionContents
case "deployments":
return PermissionDeployments
case "discussions":
return PermissionDiscussions
case "id-token":
return PermissionIdToken
case "issues":
return PermissionIssues
case "metadata":
return PermissionMetadata
case "models":
return PermissionModels
case "packages":
return PermissionPackages
case "pages":
return PermissionPages
case "pull-requests":
return PermissionPullRequests
case "repository-projects":
return PermissionRepositoryProj
case "organization-projects":
return PermissionOrganizationProj
case "security-events":
return PermissionSecurityEvents
case "statuses":
return PermissionStatuses
case "all":
// "all" is a meta-key handled at the parser level; it is not a real scope
return ""
default:
permissionsLog.Printf("Unknown permission scope key: %s", key)
return ""
}
return scope
}

// PermissionLevel represents the level of access (read, write, none)
Expand Down