Skip to content

Commit 2f7d550

Browse files
Added pr status to db
Added webhooks for close,merge,reopen,to_draft,ready_for_review added test
1 parent 0372f37 commit 2f7d550

29 files changed

+4130
-70
lines changed

.sqlx/query-66b7cb451d49e670d814d89d2a66ba3dd5df162984ca29dfdb1e893b1afca7ce.json renamed to .sqlx/query-1e5d97de9e3b8c34ac2cfa4c00a6dd191dc70a3db77def03371d8bdfde2ae5e6.json

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

.sqlx/query-0f95314b0c0debde970dd27f33ced6c3463e9e31131dbb39b4514f041e95939b.json renamed to .sqlx/query-338c4b2c1020562ee85ea270c2028bf2888fbbc9c3a96a4f57439ee138995528.json

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

.sqlx/query-44415582f7be15fa152e086db4e664a82180544d4152e616a77f5e50f9d75145.json renamed to .sqlx/query-9e8a84ab79912f65d2e2db8060bd5a0f2b98c91675d42fa0c767c13f9338b4ff.json

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

.sqlx/query-a19b72ce7c397928e41f52137bb3ecd62b02d1ab3830724ee5a107a9b6f1dbdd.json renamed to .sqlx/query-b442044623f3fddd437ef8aa5750d0cb222493180c665e1d6223438a653939ef.json

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

.sqlx/query-bf382d117c8d4509dd1da794203a6e8e5fe74e1905fecfa75707b532340e9f5e.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 down migration script here
2+
ALTER TABLE pull_request DROP COLUMN status;
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 status TEXT NOT NULL;

src/bors/event.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ pub enum BorsRepositoryEvent {
1313
PullRequestEdited(PullRequestEdited),
1414
/// When a pull request is opened.
1515
PullRequestOpened(PullRequestOpened),
16+
/// When a pull request is closed.
17+
PullRequestClosed(PullRequestClosed),
18+
// When a pull request is merged
19+
PullRequestMerged(PullRequestMerged),
20+
// When a pull request is reopened
21+
PullRequestReopened(PullRequestReopened),
22+
// When a pull request is converted to draft
23+
PullRequestConvertedToDraft(PullRequestConvertedToDraft),
24+
// When a pull request is ready for review
25+
PullRequestReadyForReview(PullRequestReadyForReview),
1626
/// When there is a push to a branch. This includes when a commit is pushed, when a commit tag is pushed,
1727
/// when a branch is deleted or when a tag is deleted.
1828
PushToBranch(PushToBranch),
@@ -32,6 +42,11 @@ impl BorsRepositoryEvent {
3242
BorsRepositoryEvent::PullRequestCommitPushed(payload) => &payload.repository,
3343
BorsRepositoryEvent::PullRequestEdited(payload) => &payload.repository,
3444
BorsRepositoryEvent::PullRequestOpened(payload) => &payload.repository,
45+
BorsRepositoryEvent::PullRequestClosed(payload) => &payload.repository,
46+
BorsRepositoryEvent::PullRequestMerged(payload) => &payload.repository,
47+
BorsRepositoryEvent::PullRequestReopened(payload) => &payload.repository,
48+
BorsRepositoryEvent::PullRequestConvertedToDraft(payload) => &payload.repository,
49+
BorsRepositoryEvent::PullRequestReadyForReview(payload) => &payload.repository,
3550
BorsRepositoryEvent::PushToBranch(payload) => &payload.repository,
3651
BorsRepositoryEvent::WorkflowStarted(workflow) => &workflow.repository,
3752
BorsRepositoryEvent::WorkflowCompleted(workflow) => &workflow.repository,
@@ -83,6 +98,37 @@ pub struct PullRequestEdited {
8398
pub struct PullRequestOpened {
8499
pub repository: GithubRepoName,
85100
pub pull_request: PullRequest,
101+
pub draft: bool,
102+
}
103+
104+
#[derive(Debug)]
105+
pub struct PullRequestClosed {
106+
pub repository: GithubRepoName,
107+
pub pull_request: PullRequest,
108+
}
109+
110+
#[derive(Debug)]
111+
pub struct PullRequestMerged {
112+
pub repository: GithubRepoName,
113+
pub pull_request: PullRequest,
114+
}
115+
116+
#[derive(Debug)]
117+
pub struct PullRequestReopened {
118+
pub repository: GithubRepoName,
119+
pub pull_request: PullRequest,
120+
}
121+
122+
#[derive(Debug)]
123+
pub struct PullRequestConvertedToDraft {
124+
pub repository: GithubRepoName,
125+
pub pull_request: PullRequest,
126+
}
127+
128+
#[derive(Debug)]
129+
pub struct PullRequestReadyForReview {
130+
pub repository: GithubRepoName,
131+
pub pull_request: PullRequest,
86132
}
87133

88134
#[derive(Debug)]

src/bors/handlers/info.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub(super) async fn command_info(
1717
pr.number,
1818
&pr.base.name,
1919
pr.mergeable_state.clone().into(),
20+
&pr.status,
2021
)
2122
.await?;
2223

0 commit comments

Comments
 (0)