diff options
-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 4974867f6..ea780e875 100644 --- a/.github/workflows/metrics.yaml +++ b/.github/workflows/metrics.yaml | |||
@@ -18,12 +18,6 @@ jobs: | |||
18 | - name: Checkout repository | 18 | - name: Checkout repository |
19 | uses: actions/checkout@v2 | 19 | uses: actions/checkout@v2 |
20 | 20 | ||
21 | - name: Checkout metrics repository | ||
22 | uses: actions/checkout@v2 | ||
23 | with: | ||
24 | repository: "rust-analyzer/metrics" | ||
25 | path: "target/metrics" | ||
26 | |||
27 | - name: Install Rust toolchain | 21 | - name: Install Rust toolchain |
28 | uses: actions-rs/toolchain@v1 | 22 | uses: actions-rs/toolchain@v1 |
29 | with: | 23 | with: |
@@ -35,4 +29,4 @@ jobs: | |||
35 | - name: Collect metrics | 29 | - name: Collect metrics |
36 | run: cargo xtask metrics | 30 | run: cargo xtask metrics |
37 | env: | 31 | env: |
38 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | 32 | METRICS_TOKEN: ${{ secrets.METRICS_TOKEN }} |
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<()> { | |||
17 | metrics.measure_build()?; | 17 | metrics.measure_build()?; |
18 | 18 | ||
19 | { | 19 | { |
20 | let _d = pushd("target/metrics"); | 20 | let _d = pushd("target"); |
21 | let api_token = env::var("METRICS_TOKEN").unwrap(); | ||
22 | let repo = format!("https://{}@github.com/rust-analyzer/metrics.git", api_token); | ||
23 | run!("git clone --depth 1 {}", repo)?; | ||
24 | let _d = pushd("metrics"); | ||
25 | |||
21 | let mut file = std::fs::OpenOptions::new().append(true).open("metrics.json")?; | 26 | let mut file = std::fs::OpenOptions::new().append(true).open("metrics.json")?; |
22 | writeln!(file, "{}", metrics.json())?; | 27 | writeln!(file, "{}", metrics.json())?; |
23 | run!("git add .")?; | 28 | run!("git add .")?; |
24 | run!("git -c user.name=Bot -c [email protected] commit --message 📈")?; | 29 | run!("git -c user.name=Bot -c [email protected] commit --message 📈")?; |
25 | 30 | run!("git push origin master")?; | |
26 | if let Ok(actor) = env::var("GITHUB_ACTOR") { | ||
27 | let token = env::var("GITHUB_TOKEN").unwrap(); | ||
28 | let repo = format!("https://{}:{}@github.com/rust-analyzer/metrics.git", actor, token); | ||
29 | run!("git push {}", repo)?; | ||
30 | } | ||
31 | } | 31 | } |
32 | eprintln!("{:#?}\n", metrics); | 32 | eprintln!("{:#?}\n", metrics); |
33 | eprintln!("{}", metrics.json()); | 33 | eprintln!("{}", metrics.json()); |