Skip to content

Commit 57e1bb8

Browse files
authored
collab: Add zed-zippy[bot] to the GET /contributor endpoint (zed-industries#43568)
This PR adds the `zed-zippy[bot]` user to the `GET /contributor` endpoint so that it passes the CLA check. Release Notes: - N/A
1 parent 5403e74 commit 57e1bb8

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

crates/collab/src/api/contributors.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ async fn check_is_contributor(
6464
}));
6565
}
6666

67+
if ZedZippyBot::is_zed_zippy_bot(&params) {
68+
return Ok(Json(CheckIsContributorResponse {
69+
signed_at: Some(
70+
ZedZippyBot::created_at()
71+
.and_utc()
72+
.to_rfc3339_opts(SecondsFormat::Millis, true),
73+
),
74+
}));
75+
}
76+
6777
Ok(Json(CheckIsContributorResponse {
6878
signed_at: app
6979
.db
@@ -103,6 +113,36 @@ impl RenovateBot {
103113
}
104114
}
105115

116+
/// The Zed Zippy bot GitHub user (`zed-zippy[bot]`).
117+
///
118+
/// https://api.github.com/users/zed-zippy[bot]
119+
struct ZedZippyBot;
120+
121+
impl ZedZippyBot {
122+
const LOGIN: &'static str = "zed-zippy[bot]";
123+
const USER_ID: i32 = 234243425;
124+
125+
/// Returns the `created_at` timestamp for the Zed Zippy bot user.
126+
fn created_at() -> &'static NaiveDateTime {
127+
static CREATED_AT: OnceLock<NaiveDateTime> = OnceLock::new();
128+
CREATED_AT.get_or_init(|| {
129+
chrono::DateTime::parse_from_rfc3339("2025-09-24T17:00:11Z")
130+
.expect("failed to parse 'created_at' for 'zed-zippy[bot]'")
131+
.naive_utc()
132+
})
133+
}
134+
135+
/// Returns whether the given contributor selector corresponds to the Zed Zippy bot user.
136+
fn is_zed_zippy_bot(contributor: &ContributorSelector) -> bool {
137+
match contributor {
138+
ContributorSelector::GitHubLogin { github_login } => github_login == Self::LOGIN,
139+
ContributorSelector::GitHubUserId { github_user_id } => {
140+
github_user_id == &Self::USER_ID
141+
}
142+
}
143+
}
144+
}
145+
106146
#[derive(Debug, Deserialize)]
107147
struct AddContributorBody {
108148
github_user_id: i32,

0 commit comments

Comments
 (0)