Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add priority option #205

Merged
merged 1 commit into from
Mar 3, 2025
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

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

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

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

This file was deleted.

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

1 change: 1 addition & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ which is by default set to `@bors`.
| `try` | `try` | Start a try build based on the most recent commit from the main branch. |
| `try parent=<sha>` | `try` | Start a try build based on the specified parent commit `sha`. |
| `try cancel` | `try` | Cancel a running try build. |
| `p=<priority>` | `try` | Set the priority of a PR. |
2 changes: 2 additions & 0 deletions migrations/20250227095730_add_priority_to_pr.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Add down migration script here
ALTER TABLE pull_request DROP COLUMN priority;
2 changes: 2 additions & 0 deletions migrations/20250227095730_add_priority_to_pr.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Add up migration script here
ALTER TABLE pull_request ADD COLUMN priority INT;
14 changes: 12 additions & 2 deletions src/bors/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ mod parser;
use crate::github::CommitSha;
pub use parser::{CommandParseError, CommandParser};

/// Priority of a commit.
pub type Priority = u32;

/// Type of parent allowed in a try build
#[derive(Clone, Debug, PartialEq)]
pub enum Parent {
Expand All @@ -23,10 +26,15 @@ pub enum Approver {
#[derive(Debug, PartialEq)]
pub enum BorsCommand {
/// Approve a commit.
Approve(Approver),
Approve {
/// Who is approving the commit.
approver: Approver,
/// Priority of the commit.
priority: Option<Priority>,
},
/// Unapprove a commit.
Unapprove,
/// Print help
/// Print help.
Help,
/// Ping the bot.
Ping,
Expand All @@ -39,4 +47,6 @@ pub enum BorsCommand {
},
/// Cancel a try build.
TryCancel,
/// Set the priority of a commit.
SetPriority(Priority),
}
Loading