Skip to content

Commit b0111b5

Browse files
committed
tokenless
1 parent f7b5415 commit b0111b5

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

services/cli/src/bencher/sub/project/run/branch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn map_hash(CliRunHash { hash, no_hash }: CliRunHash) -> Option<GitHash> {
8181
Some(head_object.id.into())
8282
}
8383

84-
fn find_repo() -> Option<gix::Repository> {
84+
pub fn find_repo() -> Option<gix::Repository> {
8585
let current_dir = std::env::current_dir().ok()?;
8686
for directory in current_dir.ancestors() {
8787
if let Ok(repo) = gix::open(directory) {

services/cli/src/bencher/sub/project/run/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::{future::Future, pin::Pin};
33
use bencher_client::types::{Adapter, JsonAverage, JsonFold, JsonNewReport, JsonReportSettings};
44
use bencher_comment::ReportComment;
55
use bencher_json::{DateTime, JsonReport, NameId, ResourceId};
6+
use project::local_project;
67

78
use crate::{
89
bencher::backend::AuthBackend,
@@ -18,6 +19,7 @@ mod ci;
1819
mod error;
1920
mod fold;
2021
mod format;
22+
mod project;
2123
pub mod runner;
2224
mod sub_adapter;
2325
pub mod thresholds;
@@ -78,6 +80,7 @@ impl TryFrom<CliRun> for Run {
7880
dry_run,
7981
backend,
8082
} = run;
83+
local_project();
8184
Ok(Self {
8285
project,
8386
branch: branch.try_into().map_err(RunError::Branch)?,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use gix::Repository;
2+
3+
use crate::bencher::sub::project::run::branch::find_repo;
4+
5+
const ROOT: &str = "root";
6+
7+
pub fn local_project() {
8+
let repo = find_repo();
9+
let repo_name = repo_name(repo.as_ref());
10+
if let Some(repo_name) = repo_name {
11+
println!("{repo_name}");
12+
}
13+
}
14+
15+
fn repo_name(repo: Option<&Repository>) -> Option<String> {
16+
let repo = repo?;
17+
let Some(parent) = repo.path().parent() else {
18+
return Some(ROOT.to_owned());
19+
};
20+
let file_name = parent.file_name()?;
21+
file_name.to_str().map(ToOwned::to_owned)
22+
}

services/console/src/content/docs-explanation/en/tokenless.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ sortOrder: 99
88
draft: true
99
---
1010

11+
reponame-computerid
12+
13+
In order for authenticated users to be able to create a project on the fly,
14+
they will need to specify the organization.
15+
So will need to add an `--org` option.
16+
1117
The goal here is to be able to run:
1218

1319
```bash

0 commit comments

Comments
 (0)