mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
Fix metrics
This commit is contained in:
parent
cc0c8b2882
commit
c0b2b15123
2 changed files with 8 additions and 14 deletions
8
.github/workflows/metrics.yaml
vendored
8
.github/workflows/metrics.yaml
vendored
|
@ -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 }}
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue