ghapi
use std::env::var;
use static_init::constructor;
use tracing::info;
#[constructor(0)]
extern "C" fn init() {
loginit::init()
}
use aok::{Result, OK};
pub const FOLLOW_USER: &[&str] = &["i18n-site", "i18nsite", "i18n-api", "i18n-cron", "i18n-ops"];
pub const FOLLOW_REPO: &[(&str, &[&str])] = &[
(
"i18n-site",
&[
"site",
"18x",
"demo.i18n.site",
"demo.i18n.site.docker",
"lib",
"font",
"md",
"plugin",
"rust",
"ie",
"alive",
"site.conf",
],
),
("i18n-api", &["pay_webhook", "pub", "srv", "srv.docker"]),
("i18n-cron", &["cron"]),
("i18n-ops", &["docker", "ops", "os", "ubuntu"]),
];
#[tokio::test]
async fn test() -> Result<()> {
let token_li = var("GITHUB_LI").unwrap();
let token_li = token_li.split_whitespace();
for (pos, token) in token_li.enumerate() {
let token = format!("gho_{token}");
let user = ghapi::User::new(token);
user
.star_user_repo(
FOLLOW_USER,
FOLLOW_REPO
.iter()
.flat_map(|(org, repo_li)| repo_li.iter().map(move |repo| format!("{org}/{repo}")))
.collect::<Vec<_>>(),
)
.await?;
info!("{}", pos);
}
OK
}
https://github.com/login/oauth/authorize?client_id=Ov23liuGAmK0plc9FgB3&scope=user:email,user:follow,public_repo