Skip to main content

ephemeris_forge_github/config/
repository.rs

1use facet::Facet;
2
3/// Who can see the repository.
4#[derive(Clone, Copy, Debug, Eq, Facet, Ord, PartialEq, PartialOrd)]
5#[repr(u8)]
6pub enum Visibility {
7    /// Anyone can see the repository.
8    #[facet(rename = "public")]
9    Public,
10    /// Only people with access can see the repository.
11    #[facet(rename = "private")]
12    Private,
13    /// Only members of the enterprise can see the repository.
14    #[facet(rename = "internal")]
15    Internal,
16}
17
18/// Who can open pull requests.
19#[derive(Clone, Copy, Debug, Default, Eq, Facet, Ord, PartialEq, PartialOrd)]
20#[repr(u8)]
21pub enum PullRequestCreationPolicy {
22    /// Anyone who can see the repository.
23    #[default]
24    #[facet(rename = "all")]
25    All,
26    /// Only people with write access.
27    #[facet(rename = "collaborators_only")]
28    CollaboratorsOnly,
29}
30
31/// The title of a squash merge commit.
32#[derive(Clone, Copy, Debug, Default, Eq, Facet, Ord, PartialEq, PartialOrd)]
33#[repr(u8)]
34pub enum SquashMergeCommitTitle {
35    /// The pull request title.
36    #[facet(rename = "PR_TITLE")]
37    PrTitle,
38    /// The commit title for one commit, otherwise the pull request title.
39    #[default]
40    #[facet(rename = "COMMIT_OR_PR_TITLE")]
41    CommitOrPrTitle,
42}
43
44/// The message of a squash merge commit.
45#[derive(Clone, Copy, Debug, Default, Eq, Facet, Ord, PartialEq, PartialOrd)]
46#[repr(u8)]
47pub enum SquashMergeCommitMessage {
48    /// The pull request body.
49    #[facet(rename = "PR_BODY")]
50    PrBody,
51    /// The messages of the squashed commits.
52    #[default]
53    #[facet(rename = "COMMIT_MESSAGES")]
54    CommitMessages,
55    /// An empty message.
56    #[facet(rename = "BLANK")]
57    Blank,
58}
59
60/// The title of a merge commit.
61#[derive(Clone, Copy, Debug, Default, Eq, Facet, Ord, PartialEq, PartialOrd)]
62#[repr(u8)]
63pub enum MergeCommitTitle {
64    /// The pull request title.
65    #[facet(rename = "PR_TITLE")]
66    PrTitle,
67    /// The default merge message.
68    #[default]
69    #[facet(rename = "MERGE_MESSAGE")]
70    MergeMessage,
71}
72
73/// The message of a merge commit.
74#[derive(Clone, Copy, Debug, Default, Eq, Facet, Ord, PartialEq, PartialOrd)]
75#[repr(u8)]
76pub enum MergeCommitMessage {
77    /// The pull request body.
78    #[facet(rename = "PR_BODY")]
79    PrBody,
80    /// The pull request title.
81    #[default]
82    #[facet(rename = "PR_TITLE")]
83    PrTitle,
84    /// An empty message.
85    #[facet(rename = "BLANK")]
86    Blank,
87}
88
89/// Desired settings for a repository.
90#[derive(Clone, Debug, Eq, Facet, PartialEq)]
91#[facet(deny_unknown_fields)]
92pub struct Repository {
93    /// The one-line summary shown on the repository's landing page. Null leaves
94    /// it alone.
95    pub description: Option<String>,
96    /// The project home page. Null leaves it alone.
97    pub homepage: Option<String>,
98    /// Who can see the repository. Null leaves it alone.
99    pub visibility: Option<Visibility>,
100    /// Topic labels used for discovery and filtering. Null leaves it alone.
101    pub topics: Option<Vec<String>>,
102    /// Whether the issue tracker is enabled. Null leaves it alone.
103    pub has_issues: Option<bool>,
104    /// Whether project boards are enabled. Null leaves it alone.
105    pub has_projects: Option<bool>,
106    /// Whether the wiki is enabled. Null leaves it alone.
107    pub has_wiki: Option<bool>,
108    /// Whether pull requests are enabled. Null leaves it alone.
109    pub has_pull_requests: Option<bool>,
110    /// Whether discussions are enabled. Null leaves it alone.
111    pub has_discussions: Option<bool>,
112    /// Who can open pull requests. Null leaves it alone.
113    pub pull_request_creation_policy: Option<PullRequestCreationPolicy>,
114    /// Whether the repository is a template. Null leaves it alone.
115    pub is_template: Option<bool>,
116    /// The default branch. Null leaves it alone.
117    pub default_branch: Option<String>,
118    /// Whether merging is allowed to squash commits into one. Null leaves it
119    /// alone.
120    pub allow_squash_merge: Option<bool>,
121    /// Whether merging is allowed to create a merge commit. Null leaves it
122    /// alone.
123    pub allow_merge_commit: Option<bool>,
124    /// Whether merging is allowed to rebase commits onto the base branch. Null
125    /// leaves it alone.
126    pub allow_rebase_merge: Option<bool>,
127    /// Whether pull requests may merge automatically once checks pass. Null
128    /// leaves it alone.
129    pub allow_auto_merge: Option<bool>,
130    /// Whether the source branch is deleted automatically after merging. Null
131    /// leaves it alone.
132    pub delete_branch_on_merge: Option<bool>,
133    /// Whether a pull request branch may be updated from the base branch. Null
134    /// leaves it alone.
135    pub allow_update_branch: Option<bool>,
136    /// The title of a squash merge commit. Null leaves it alone.
137    pub squash_merge_commit_title: Option<SquashMergeCommitTitle>,
138    /// The message of a squash merge commit. Null leaves it alone.
139    pub squash_merge_commit_message: Option<SquashMergeCommitMessage>,
140    /// The title of a merge commit. Null leaves it alone.
141    pub merge_commit_title: Option<MergeCommitTitle>,
142    /// The message of a merge commit. Null leaves it alone.
143    pub merge_commit_message: Option<MergeCommitMessage>,
144    /// Whether the repository is archived. Null leaves it alone.
145    pub archived: Option<bool>,
146    /// Whether private forks are allowed. Null leaves it alone.
147    pub allow_forking: Option<bool>,
148    /// Whether web commits need a sign-off. Null leaves it alone.
149    pub web_commit_signoff_required: Option<bool>,
150    /// Whether published releases become immutable. Null leaves it alone.
151    pub immutable_releases: Option<bool>,
152}