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 .github/workflows/ci-doctor.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/sub-issue-closer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/workflow-health-manager.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/workflow/data/action_pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
"version": "v4.3.1",
"sha": "67a3573c9a986a3f9c594539f4ab511d57bb3ce9"
},
"actions/setup-go@v5": {
"repo": "actions/setup-go",
"version": "v5",
"sha": "40f1582b2485089dde7abd97c1529aa768e1baff"
},
"actions/setup-go@v6.2.0": {
"repo": "actions/setup-go",
"version": "v6.2.0",
Expand Down
31 changes: 23 additions & 8 deletions pkg/workflow/update_entity_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@
// body: null # Can update body (key exists)
// ```
//
// 2. **Bool Value Mode** (for pull requests):
// Fields are enabled based on explicit boolean values:
// 2. **Bool Value Mode** (for body/footer fields in all entities):
// Fields are enabled based on explicit boolean values.
// Special case: null values are treated as true for backward compatibility:
// ```yaml
// update-issue:
// body: true # Explicitly enable body updates
// body: false # Explicitly disable body updates
// body: null # Treated as true (backward compatibility)
// body: # Same as null, treated as true
// update-pull-request:
// title: true # Can update title
// body: false # Cannot update body
// title: true # Can update title
// body: false # Cannot update body
// ```
Comment on lines +43 to 55
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation incorrectly states that FieldParsingBoolValue mode is used for "body/footer fields in all entities". However, this is not accurate:

  • update-issue uses it for: body, footer (correct)
  • update-pull-request uses it for: title, body (not just body/footer)
  • update-discussion uses it for: footer only (body uses KeyExistence mode)
  • update-release uses it for: footer only (no body field)

The documentation should be updated to accurately reflect which fields use this mode, or use a more general description like "certain update fields that support explicit true/false configuration".

This issue also appears on line 203 of the same file.

Copilot uses AI. Check for mistakes.
//
// # When to Use vs Alternatives
Expand Down Expand Up @@ -194,8 +200,9 @@ const (
// FieldParsingKeyExistence mode: Field presence (even if nil) indicates it can be updated
// Used by update-issue and update-discussion
FieldParsingKeyExistence FieldParsingMode = iota
// FieldParsingBoolValue mode: Field's boolean value determines if it can be updated
// Used by update-pull-request (defaults to true if nil)
// FieldParsingBoolValue mode: Field's boolean value determines if it can be updated.
// Special case: nil values are treated as true for backward compatibility.
// Used by body/footer fields in all update entities.
FieldParsingBoolValue
)

Expand All @@ -212,7 +219,9 @@ const (
//
// Behavior by mode:
// - FieldParsingKeyExistence: Returns new(bool) if key exists, nil otherwise
// - FieldParsingBoolValue: Returns &boolValue if key exists and is bool, nil otherwise
// - FieldParsingBoolValue: Returns &boolValue if key exists and is bool.
// Special case: if key exists with nil value (e.g., body: null), returns &true
// for backward compatibility. Returns nil for other non-bool values (invalid config).
func parseUpdateEntityBoolField(configMap map[string]any, fieldName string, mode FieldParsingMode) *bool {
if configMap == nil {
return nil
Expand All @@ -233,7 +242,13 @@ func parseUpdateEntityBoolField(configMap map[string]any, fieldName string, mode
if boolVal, ok := val.(bool); ok {
return &boolVal
}
// If present but not a bool (e.g., null), return nil (no explicit setting)
// If value is explicitly nil (not a bool), treat as true (explicit enablement)
// This maintains backward compatibility where body: null enables the field
if val == nil {
trueVal := true
return &trueVal
}
// For other non-bool values (like strings), return nil (invalid config)
return nil

default:
Expand Down
3 changes: 2 additions & 1 deletion pkg/workflow/update_entity_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ func TestParseUpdateEntityBoolField(t *testing.T) {
configMap: map[string]any{"title": nil},
fieldName: "title",
mode: FieldParsingBoolValue,
wantNil: true, // Non-bool values return nil
wantNil: false, // Nil values are treated as true (explicit enablement)
wantValue: true, // Defaults to true for backward compatibility
},
{
name: "bool value mode: string value (not a bool)",
Expand Down
11 changes: 7 additions & 4 deletions pkg/workflow/update_issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,13 @@ This workflow tests body: (null) for backward compatibility.
t.Fatal("Expected update-issue configuration to be parsed")
}

// With FieldParsingBoolValue mode, null values result in nil pointer
// The handler will default to true via AddBoolPtrOrDefault
// With FieldParsingBoolValue mode, null values are treated as true (explicit enablement)
// This maintains backward compatibility where body: enables body updates
if workflowData.SafeOutputs.UpdateIssues.Body != nil {
t.Fatal("Expected body to be nil when set to null (will default to true in handler)")
if workflowData.SafeOutputs.UpdateIssues.Body == nil {
t.Fatal("Expected body to be non-nil when set to null")
}

if !*workflowData.SafeOutputs.UpdateIssues.Body {
t.Fatal("Expected body to be true when set to null (backward compatibility)")
}
}
Loading