From c0b2b15123e500e5af90138646f20024ca746f86 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 24 Jul 2020 20:53:08 +0200 Subject: Fix metrics --- xtask/src/metrics.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xtask') diff --git a/xtask/src/metrics.rs b/xtask/src/metrics.rs index 612bef51f..bb3044f41 100644 --- a/xtask/src/metrics.rs +++ b/xtask/src/metrics.rs @@ -17,17 +17,17 @@ pub fn run_metrics() -> Result<()> { metrics.measure_build()?; { - let _d = pushd("target/metrics"); + let _d = pushd("target"); + let api_token = env::var("METRICS_TOKEN").unwrap(); + let repo = format!("https://{}@github.com/rust-analyzer/metrics.git", api_token); + run!("git clone --depth 1 {}", repo)?; + let _d = pushd("metrics"); + let mut file = std::fs::OpenOptions::new().append(true).open("metrics.json")?; writeln!(file, "{}", metrics.json())?; run!("git add .")?; run!("git -c user.name=Bot -c user.email=dummy@example.com commit --message 📈")?; - - if let Ok(actor) = env::var("GITHUB_ACTOR") { - let token = env::var("GITHUB_TOKEN").unwrap(); - let repo = format!("https://{}:{}@github.com/rust-analyzer/metrics.git", actor, token); - run!("git push {}", repo)?; - } + run!("git push origin master")?; } eprintln!("{:#?}\n", metrics); eprintln!("{}", metrics.json()); -- cgit v1.2.3