| 1 | use crate::pulls::MergeStyle; |
| 2 | |
| 3 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 4 | pub enum QueueState { |
| 5 | Queued, |
| 6 | Testing, |
| 7 | Merging, |
| 8 | Failed, |
| 9 | Removed, |
| 10 | } |
| 11 | |
| 12 | string_enum!(QueueState { |
| 13 | Queued = "queued", |
| 14 | Testing = "testing", |
| 15 | Merging = "merging", |
| 16 | Failed = "failed", |
| 17 | Removed = "removed", |
| 18 | }); |
| 19 | |
| 20 | #[derive(Debug, Clone, PartialEq, Eq)] |
| 21 | pub struct QueueEntry { |
| 22 | pub id: String, |
| 23 | pub repo_id: String, |
| 24 | pub branch: String, |
| 25 | pub issue_id: String, |
| 26 | pub pull_number: i64, |
| 27 | pub merge_style: MergeStyle, |
| 28 | pub state: QueueState, |
| 29 | pub seq: i64, |
| 30 | pub enqueued_by: String, |
| 31 | pub enqueued_at: String, |
| 32 | pub updated_at: String, |
| 33 | pub finished_at: Option<String>, |
| 34 | pub reason: Option<String>, |
| 35 | pub base_oid: Option<String>, |
| 36 | pub tested_oid: Option<String>, |
| 37 | pub test_ref: Option<String>, |
| 38 | pub run_id: Option<String>, |
| 39 | } |
| 40 | |
| 41 | pub fn test_ref_name(branch: &str, number: i64) -> String { |
| 42 | format!("refs/forge/merge-queue/{branch}/{number}") |
| 43 | } |