Skip to content

Commit 48d9a4e

Browse files
authored
Merge pull request #219 from Sakib25800/feat/detect-unmergeability
feat: track mergeability
2 parents 9ace44c + f872320 commit 48d9a4e

23 files changed

+661
-71
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
target/
2-
.env
2+
.env
3+
.DS_Store

.sqlx/query-d6aed6aa0d89754e5dbe1fdafd3fbccb522960b2a1b81bba5fa197e9da710126.json renamed to .sqlx/query-44415582f7be15fa152e086db4e664a82180544d4152e616a77f5e50f9d75145.json

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-80d2c1b695162729675c566946a145a78feed990078fbd50a83ada38a225597d.json renamed to .sqlx/query-66b7cb451d49e670d814d89d2a66ba3dd5df162984ca29dfdb1e893b1afca7ce.json

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-b7827a8eb8b11c8d6751498aba4d62c28372f666fec43294ebe94dabf0f46923.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-eba0377c0959404d5d208aae9763a92186f2a784639b87661f4d1ce68cc995ea.json

Lines changed: 121 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-fdb7f932af60a3c579516e8ff8ed3866cce4fd88b2f41f78a5ddaa2489e796fb.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Add up migration script here
2+
ALTER TABLE pull_request ADD COLUMN mergeable_state TEXT NOT NULL DEFAULT 'unknown';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Add down migration script here
2+
ALTER TABLE pull_request DROP COLUMN mergeable_state;

src/bors/event.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ pub enum BorsRepositoryEvent {
1313
PullRequestEdited(PullRequestEdited),
1414
/// When a pull request is opened.
1515
PullRequestOpened(PullRequestOpened),
16+
/// When there is a push to a branch. This includes when a commit is pushed, when a commit tag is pushed,
17+
/// when a branch is deleted or when a tag is deleted.
18+
PushToBranch(PushToBranch),
1619
/// A workflow run on Github Actions or a check run from external CI system has been started.
1720
WorkflowStarted(WorkflowStarted),
1821
/// A workflow run on Github Actions or a check run from external CI system has been completed.
@@ -29,6 +32,7 @@ impl BorsRepositoryEvent {
2932
BorsRepositoryEvent::PullRequestCommitPushed(payload) => &payload.repository,
3033
BorsRepositoryEvent::PullRequestEdited(payload) => &payload.repository,
3134
BorsRepositoryEvent::PullRequestOpened(payload) => &payload.repository,
35+
BorsRepositoryEvent::PushToBranch(payload) => &payload.repository,
3236
BorsRepositoryEvent::WorkflowStarted(workflow) => &workflow.repository,
3337
BorsRepositoryEvent::WorkflowCompleted(workflow) => &workflow.repository,
3438
BorsRepositoryEvent::CheckSuiteCompleted(payload) => &payload.repository,
@@ -81,6 +85,12 @@ pub struct PullRequestOpened {
8185
pub pull_request: PullRequest,
8286
}
8387

88+
#[derive(Debug)]
89+
pub struct PushToBranch {
90+
pub repository: GithubRepoName,
91+
pub branch: String,
92+
}
93+
8494
#[derive(Debug)]
8595
pub struct WorkflowStarted {
8696
pub repository: GithubRepoName,

src/bors/handlers/info.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ pub(super) async fn command_info(
1212
) -> anyhow::Result<()> {
1313
// Geting PR info from database
1414
let pr_model = db
15-
.get_or_create_pull_request(repo.client.repository(), pr.number, &pr.base.name)
15+
.get_or_create_pull_request(
16+
repo.client.repository(),
17+
pr.number,
18+
&pr.base.name,
19+
pr.mergeable_state.clone().into(),
20+
)
1621
.await?;
1722

1823
// Building the info message

0 commit comments

Comments
 (0)