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
2 changes: 1 addition & 1 deletion pkg/constants/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ constants.PriorityWorkflowFields // []string{"on","permissions","if","network",
constants.IgnoredFrontmatterFields // []string{"user-invokable"}

// Fields forbidden in shared/imported workflows (only valid in main workflows)
constants.SharedWorkflowForbiddenFields // []string{"on","command","concurrency",...}
constants.SharedWorkflowForbiddenFields // []string{"on","concurrency","container",...}

// Events that do not require permission checks
constants.SafeWorkflowEvents // []string{"workflow_dispatch","schedule"}
Expand Down
7 changes: 2 additions & 5 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,30 +322,27 @@ var IgnoredFrontmatterFields = []string{"user-invokable"}
//
// Forbidden fields fall into these categories:
// - Workflow triggers: on (defines it as a main workflow)
// - Workflow execution: command, run-name, runs-on, concurrency, if, timeout-minutes, timeout_minutes
// - Workflow execution: run-name, runs-on, concurrency, if, timeout-minutes
// - Workflow metadata: name, tracker-id, strict
// - Workflow features: container, environment, sandbox, features
// - Access control: roles, github-token
// - Access control: github-token
//
// All other fields defined in main_workflow_schema.json can be used in shared workflows
// and will be properly imported and merged when the shared workflow is imported.
var SharedWorkflowForbiddenFields = []string{
"on", // Trigger field - only for main workflows
"command", // Command for workflow execution
"concurrency", // Concurrency control
"container", // Container configuration
"environment", // Deployment environment
"features", // Feature flags
"github-token", // GitHub token configuration
"if", // Conditional execution
"name", // Workflow name
"roles", // Role requirements
"run-name", // Run display name
"runs-on", // Runner specification
"sandbox", // Sandbox configuration
"strict", // Strict mode
"timeout-minutes", // Timeout in minutes
"timeout_minutes", // Timeout in minutes (underscore variant)
"tracker-id", // Tracker ID
}
Comment on lines 332 to 347

Expand Down
3 changes: 0 additions & 3 deletions pkg/workflow/forbidden_fields_import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func TestForbiddenFieldsImportRejection(t *testing.T) {
// Use the SharedWorkflowForbiddenFields constant and create YAML examples for each
forbiddenFieldYAML := map[string]string{
Comment on lines 19 to 20
"on": `on: issues`,
"command": `command: /help`,
"concurrency": `concurrency: production`,
"container": `container: node:lts`,
"env": `env: {NODE_ENV: production}`,
Expand All @@ -28,13 +27,11 @@ func TestForbiddenFieldsImportRejection(t *testing.T) {
"github-token": `github-token: ${{ secrets.TOKEN }}`,
"if": `if: success()`,
"name": `name: Test Workflow`,
"roles": `roles: ["admin"]`,
"run-name": `run-name: Test Run`,
"runs-on": `runs-on: ubuntu-latest`,
"sandbox": `sandbox: {enabled: true}`,
"strict": `strict: true`,
"timeout-minutes": `timeout-minutes: 30`,
"timeout_minutes": `timeout_minutes: 30`,
"tracker-id": `tracker-id: "12345"`,
}

Expand Down