Skip to content

Commit c0b2b15

Browse files
committed
Fix metrics
1 parent cc0c8b2 commit c0b2b15

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

.github/workflows/metrics.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ jobs:
1818
- name: Checkout repository
1919
uses: actions/checkout@v2
2020

21-
- name: Checkout metrics repository
22-
uses: actions/checkout@v2
23-
with:
24-
repository: "rust-analyzer/metrics"
25-
path: "target/metrics"
26-
2721
- name: Install Rust toolchain
2822
uses: actions-rs/toolchain@v1
2923
with:
@@ -35,4 +29,4 @@ jobs:
3529
- name: Collect metrics
3630
run: cargo xtask metrics
3731
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
METRICS_TOKEN: ${{ secrets.METRICS_TOKEN }}

xtask/src/metrics.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ pub fn run_metrics() -> Result<()> {
1717
metrics.measure_build()?;
1818

1919
{
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+
2126
let mut file = std::fs::OpenOptions::new().append(true).open("metrics.json")?;
2227
writeln!(file, "{}", metrics.json())?;
2328
run!("git add .")?;
2429
run!("git -c user.name=Bot -c [email protected] commit --message 📈")?;
25-
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-
}
30+
run!("git push origin master")?;
3131
}
3232
eprintln!("{:#?}\n", metrics);
3333
eprintln!("{}", metrics.json());

0 commit comments

Comments
 (0)