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
24 changes: 22 additions & 2 deletions src/safeoutputs/create_pr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,9 @@ impl Executor for CreatePrResult {
}
});

// Only set autoCompleteSetBy if auto_complete is enabled
if config.auto_complete {
// Only set autoCompleteSetBy if auto_complete is enabled and PR is not a draft
// (ADO silently ignores auto-complete on draft PRs, so skip the API call)
if config.auto_complete && !config.draft {
update_body["autoCompleteSetBy"] = serde_json::json!({
"id": pr_data["createdBy"]["id"]
});
Expand Down Expand Up @@ -2253,4 +2254,23 @@ new file mode 100755
assert!(!paths.contains(&"/dev/null".to_string()));
}

#[test]
fn test_default_config_draft_true_autocomplete_false() {
let config = CreatePrConfig::default();
assert!(config.draft, "draft should default to true");
assert!(!config.auto_complete, "auto_complete should default to false");
}

#[test]
fn test_config_deserialize_draft_false_autocomplete_true() {
let yaml = r#"
target-branch: main
draft: false
auto-complete: true
"#;
let config: CreatePrConfig = serde_yaml::from_str(yaml).unwrap();
assert!(!config.draft);
assert!(config.auto_complete);
}

}
Loading