Skip to content

Commit cb7f3bd

Browse files
KobzolMark-Simulacrum
authored andcommitted
Add auto_merge option to repositories
1 parent fd14d8a commit cb7f3bd

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

rust_team_data/src/v1.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ pub struct Repo {
168168
pub members: Vec<RepoMember>,
169169
pub branch_protections: Vec<BranchProtection>,
170170
pub archived: bool,
171+
// Is the GitHub "Auto-merge" option enabled?
172+
// https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request
173+
pub auto_merge_enabled: bool,
171174
}
172175

173176
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]

src/schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ pub(crate) struct Repo {
757757
pub branch_protections: Vec<BranchProtection>,
758758
}
759759

760-
#[derive(serde_derive::Deserialize, Debug, Clone)]
760+
#[derive(serde_derive::Deserialize, Debug, Clone, PartialEq)]
761761
#[serde(rename_all = "kebab-case")]
762762
pub(crate) enum Bot {
763763
Bors,

src/static_api.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ impl<'a> Generator<'a> {
5454
allowed_merge_teams: b.allowed_merge_teams.clone(),
5555
})
5656
.collect();
57+
let managed_by_bors = r.bots.contains(&Bot::Bors);
5758
let repo = v1::Repo {
5859
org: r.org.clone(),
5960
name: r.name.clone(),
@@ -106,6 +107,7 @@ impl<'a> Generator<'a> {
106107
.collect(),
107108
branch_protections,
108109
archived,
110+
auto_merge_enabled: !managed_by_bors,
109111
};
110112

111113
self.add(&format!("v1/repos/{}.json", r.name), &repo)?;

tests/static-api/_expected/v1/repos.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"allowed_merge_teams": []
2525
}
2626
],
27-
"archived": true
27+
"archived": true,
28+
"auto_merge_enabled": true
2829
},
2930
{
3031
"org": "test-org",
@@ -52,7 +53,8 @@
5253
]
5354
}
5455
],
55-
"archived": false
56+
"archived": false,
57+
"auto_merge_enabled": true
5658
}
5759
]
5860
}

tests/static-api/_expected/v1/repos/archived_repo.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
"allowed_merge_teams": []
2323
}
2424
],
25-
"archived": true
25+
"archived": true,
26+
"auto_merge_enabled": true
2627
}

tests/static-api/_expected/v1/repos/some_repo.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
]
2525
}
2626
],
27-
"archived": false
27+
"archived": false,
28+
"auto_merge_enabled": true
2829
}

0 commit comments

Comments
 (0)