diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2020-07-24 20:53:08 +0200 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2020-07-24 20:53:27 +0200 |
| commit | c0b2b15123e500e5af90138646f20024ca746f86 (patch) | |
| tree | 802deaf00f705e2370c238cfe92935e1100b0706 | |
| parent | cc0c8b2882c7a0b00bc30e0c22040f7d4ba9f584 (diff) | |
| download | rust-c0b2b15123e500e5af90138646f20024ca746f86.tar.gz rust-c0b2b15123e500e5af90138646f20024ca746f86.zip | |
Fix metrics
| -rw-r--r-- | .github/workflows/metrics.yaml | 8 | ||||
| -rw-r--r-- | xtask/src/metrics.rs | 14 |
2 files changed, 8 insertions, 14 deletions
diff --git a/.github/workflows/metrics.yaml b/.github/workflows/metrics.yaml index 4974867f639..ea780e8756e 100644 --- a/.github/workflows/metrics.yaml +++ b/.github/workflows/metrics.yaml @@ -18,12 +18,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Checkout metrics repository - uses: actions/checkout@v2 - with: - repository: "rust-analyzer/metrics" - path: "target/metrics" - - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: @@ -35,4 +29,4 @@ jobs: - name: Collect metrics run: cargo xtask metrics env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + METRICS_TOKEN: ${{ secrets.METRICS_TOKEN }} diff --git a/xtask/src/metrics.rs b/xtask/src/metrics.rs index 612bef51f8d..bb3044f4111 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()); |
