Skip to content

Commit 8d4f2a7

Browse files
KobzolMark-Simulacrum
authored andcommitted
Add the possibility to mark a repository as private
This attribute won't be synced by sync-team, it only serves as documentation.
1 parent f6e341f commit 8d4f2a7

File tree

7 files changed

+13
-0
lines changed

7 files changed

+13
-0
lines changed

docs/toml-schema.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ description = "A repo for awesome things!"
263263
homepage = "https://www.rust-lang.org/"
264264
# The bots that this repo requires (required)
265265
bots = ["bors", "rustbot", "rust-timer"]
266+
# Should the repository be private? (optional - default `false`)
267+
# Note that this only serves for documentation purposes, it is
268+
# not synchronized by automation.
269+
private-non-synced = false
266270

267271
# The teams that have access to this repo along
268272
# with the access level. (required)

rust_team_data/src/v1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ pub struct Repo {
170170
pub members: Vec<RepoMember>,
171171
pub branch_protections: Vec<BranchProtection>,
172172
pub archived: bool,
173+
// This attribute is not synced by sync-team.
174+
pub private: bool,
173175
// Is the GitHub "Auto-merge" option enabled?
174176
// https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request
175177
pub auto_merge_enabled: bool,

src/schema.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,8 @@ pub(crate) struct Repo {
751751
pub name: String,
752752
pub description: String,
753753
pub homepage: Option<String>,
754+
#[serde(default)]
755+
pub private_non_synced: Option<bool>,
754756
pub bots: Vec<Bot>,
755757
pub access: RepoAccess,
756758
#[serde(default)]

src/static_api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl<'a> Generator<'a> {
6060
name: r.name.clone(),
6161
description: r.description.clone(),
6262
homepage: r.homepage.clone(),
63+
private: r.private_non_synced.unwrap_or(false),
6364
bots: r
6465
.bots
6566
.iter()

tests/static-api/_expected/v1/repos.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
}
2626
],
2727
"archived": true,
28+
"private": false,
2829
"auto_merge_enabled": true
2930
},
3031
{
@@ -54,6 +55,7 @@
5455
}
5556
],
5657
"archived": false,
58+
"private": false,
5759
"auto_merge_enabled": true
5860
}
5961
]

tests/static-api/_expected/v1/repos/archived_repo.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
}
2424
],
2525
"archived": true,
26+
"private": false,
2627
"auto_merge_enabled": true
2728
}

tests/static-api/_expected/v1/repos/some_repo.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
}
2626
],
2727
"archived": false,
28+
"private": false,
2829
"auto_merge_enabled": true
2930
}

0 commit comments

Comments
 (0)