Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

Commit

Merge branch 'worktree-agent-ae4528f3b3dc72f27'

syntaqxcommitted Parentsf7a08d49c975f0Browse files
6 files+44−120/6 viewed
+19−3
15331533 Op::ListRepos => "Repositories you can see, optionally filtered by a search query.",
15341534 Op::GetRepo => "One repository's details.",
15351535 Op::UpdateRepo => {
1536− "Change a repository's website, topics and default branch, whether its default branch is protected, whether it is private, whether a private repository may be forked, and the most branches and tags one push may change (max_ref_updates). Only the fields given are changed. Its website and topics need the Maintain role or higher; protecting its default branch, making it public or private, allowing forking, max_ref_updates and changing its default branch need the Admin role (and making it public or private, the workspace's member privileges to allow it, unless you are an owner), and a free workspace takes a private repository only while its private storage has room. A protected branch refuses pushes and changes only by merging a pull request. A new default branch must already exist; open pull requests then merge into it. A fork cannot be made public or private: it is as visible as its parent until it is detached (detach_fork). A repository has no description: its project has, changed with update_project."
1536+ "Change a repository's website, topics and default branch, whether its default branch is protected, whether it is private, whether a private repository may be forked, and the most branches and tags one push may change (max_ref_updates). Only the fields given are changed. Its website and topics need the Maintain role or higher; protecting its default branch, making it public or private, allowing forking, max_ref_updates and changing its default branch need the Admin role (and making it public or private, the workspace's member privileges to allow it, unless you are an owner), and a free workspace takes a private repository only while its private storage has room. A protected branch refuses pushes and changes only by merging a pull request. A new default branch must already exist; open pull requests then merge into it. A fork cannot be made public or private: it is as visible as its parent until it is detached (detach_fork). A repository has no description of its own: description changes its project's, as update_project does, and needs the Maintain role or higher."
15371537 }
15381538 Op::RenameRepo => {
15391539 "Give a repository a new name in its workspace. Needs the Admin role. Everything stays with it: git data, issues, pull requests, workflow runs, deployments, secrets and webhooks. Its old address keeps working: web pages, git remotes and API calls redirect to the new one until a repository is made at the old address. The new name must be free in the workspace, including names held by recently deleted repositories."
23702370 Op::UpdateRepo => object(
23712371 json!({
23722372 "repo": repo_schema(),
2373− "description": { "type": "string", "description": "An empty string clears it." },
2373+ "description": { "type": "string", "description": "What it is, in a line: the description of its project, as update_project sets it. A repository has none of its own. An empty string clears it." },
23742374 "private": { "type": "boolean" },
23752375 "protected": {
23762376 "type": "boolean",
45884588 &json!({
45894589 "actor": actor(),
45904590 "path": repo,
4591− "description": input["description"].as_str(),
45924591 "isPrivate": input["private"].as_bool(),
45934592 "protected": input["protected"].as_bool(),
45944593 "topics": strings(input, "topics"),
45994598 }),
46004599 )
46014600 .await?;
4601+ // A repository has no description: the one given is its
4602+ // project's, changed as update_project changes it ("" clears it).
4603+ let updated = match (updated, input["description"].as_str()) {
4604+ (Outcome::Ok(changed), Some(description)) => {
4605+ let described: Outcome<Value> = call(
4606+ &services.projects,
4607+ "describe",
4608+ &json!({ "actor": actor(), "repoId": changed["id"], "description": description }),
4609+ )
4610+ .await?;
4611+ match described {
4612+ Outcome::Ok(_) => Outcome::Ok(changed),
4613+ Outcome::Fail(failure) => Outcome::Fail(failure),
4614+ }
4615+ }
4616+ (updated, _) => updated,
4617+ };
46024618 // A new default branch, once the rest has been changed.
46034619 match (&updated, optional_text(input, "default_branch")) {
46044620 (Outcome::Ok(_), Some(branch)) => {
+1−1
702702 "website": "https://hello.g1t.page",
703703 "archived_at": null
704704 },
705− "notes": "Only the fields given change. `website` gets `https://` when no scheme is given; an empty string clears it. `default_branch` must name a branch that exists (`422` otherwise); it is changed after the other fields. `description`, `website`, `topics` and `protected` need the Maintain role or higher, and `private`, `allow_forking`, `max_ref_updates` and `default_branch` the Admin role (`403` otherwise, saying which role). Changing `private` here needs no confirmation; `POST /repos/{owner}/{name}/visibility` asks for one. Making it private is refused with `402` when a free workspace's private storage has no room for it. A fork cannot change `private` (`422`): detach it first. See [Managing a repository](/guides/managing-repositories/) and [Access and roles](/guides/access-and-roles/)."
705+ "notes": "Only the fields given change. A repository has no description of its own: `description` changes its project's, as [`update_project`](/reference/api/projects/update-project/) does; an empty string clears it. `website` gets `https://` when no scheme is given; an empty string clears it. `default_branch` must name a branch that exists (`422` otherwise); it is changed after the other fields. `description`, `website`, `topics` and `protected` need the Maintain role or higher, and `private`, `allow_forking`, `max_ref_updates` and `default_branch` the Admin role (`403` otherwise, saying which role). Changing `private` here needs no confirmation; `POST /repos/{owner}/{name}/visibility` asks for one. Making it private is refused with `402` when a free workspace's private storage has no room for it. A fork cannot change `private` (`422`): detach it first. See [Managing a repository](/guides/managing-repositories/) and [Access and roles](/guides/access-and-roles/)."
706706 },
707707 "transfer_repo": {
708708 "request": {
+1−1
8686 a("tarball", Op::Archives(ArchiveOp::DownloadTarball), "A 10-minute link to a branch, tag or commit as a .tar.gz"),
8787 a("zipball", Op::Archives(ArchiveOp::DownloadZipball), "A 10-minute link to a branch, tag or commit as a .zip"),
8888 a("create", Op::CreateRepo, "Create one, empty or copied from a public git URL"),
89− a("update", Op::UpdateRepo, "Change website, topics, default branch, protection, forking"),
89+ a("update", Op::UpdateRepo, "Change description (its project's), website, topics, default branch, protection, forking"),
9090 a("get_settings", Op::GetRepoSettings, "How pull requests merge, and the default branch's protection as its rules stack"),
9191 a("update_settings", Op::UpdateRepoSettings, "Change how pull requests merge and the default branch protection ruleset"),
9292 a("check_names", Op::ListCheckNames, "Check names reported lately, to require in a ruleset"),
+3−1
2121 [project](/guides/projects/) has, and search, link previews and lists of
2222 repositories show that one. Change it in the project's **Settings →
2323 General**, or with
24−[`update_project`](/reference/api/projects/update-project/).
24+[`update_project`](/reference/api/projects/update-project/) (or
25+`description` on [`update_repo`](/reference/api/repositories/update-repo/),
26+which changes the same one).
2527
2628 The **Code** page shows its files with its facts beside them. On a phone
2729 they come after the files.
+0−0

Binary or large file; its contents are not shown.

+20−6
726726 if let Some(home) = &home {
727727 folders.push(home.join(".g1t-runner"));
728728 }
729− // The desktop app's data folder (its `app_data_dir`): runner/host.
730− let data = match std::env::consts::OS {
731− "windows" => std::env::var_os("APPDATA").map(PathBuf::from),
732− "macos" => home.as_ref().map(|h| h.join("Library").join("Application Support")),
733− _ => std::env::var_os("XDG_DATA_HOME").filter(|d| !d.is_empty()).map(PathBuf::from).or_else(|| home.as_ref().map(|h| h.join(".local").join("share"))),
729+ // The desktop app's data folders: runner/host. On Windows it keeps its
730+ // runner in local data (%LOCALAPPDATA%), and in roaming data
731+ // (%APPDATA%) on a computer that set it up there before; elsewhere the
732+ // two are one folder.
733+ let data: Vec<PathBuf> = match std::env::consts::OS {
734+ "windows" => ["LOCALAPPDATA", "APPDATA"].iter().filter_map(|var| std::env::var_os(var)).map(PathBuf::from).collect(),
735+ "macos" => home.iter().map(|h| h.join("Library").join("Application Support")).collect(),
736+ _ => std::env::var_os("XDG_DATA_HOME").filter(|d| !d.is_empty()).map(PathBuf::from).or_else(|| home.as_ref().map(|h| h.join(".local").join("share"))).into_iter().collect(),
734737 };
735− if let Some(data) = data {
738+ for data in data {
736739 folders.push(data.join("sh.g1t.desktop").join("runner").join("host"));
737740 }
738741 folders.dedup();
13481351 assert!(said.contains("as you") && said.contains("g1t-runner remove --dir"), "{said}");
13491352 // The desktop app's folder for running jobs directly is looked at.
13501353 assert!(host_runner_folders().iter().any(|f| f.ends_with(Path::new("sh.g1t.desktop").join("runner").join("host"))));
1354+ // On Windows, both where it keeps it now (local data) and where it
1355+ // kept it before (roaming data).
1356+ if cfg!(windows) {
1357+ let folders = host_runner_folders();
1358+ for var in ["LOCALAPPDATA", "APPDATA"] {
1359+ if let Some(data) = std::env::var_os(var) {
1360+ let expected = PathBuf::from(data).join("sh.g1t.desktop").join("runner").join("host");
1361+ assert!(folders.contains(&expected), "{var}: {folders:?}");
1362+ }
1363+ }
1364+ }
13511365 // An older status, without warnings, still reads.
13521366 let old: Status = serde_json::from_str(r#"{"schema":1,"state":"absent","backend":null,"runner_version":null,"launcher_version":"0.3.0","image_version":null,"isolation":null,"job":null,"error":null,"resources":{"cpus":0,"memory_mib":0,"disk_gib":0},"capabilities":[],"state_dir":"x"}"#).unwrap();
13531367 assert!(old.warnings.is_empty());

Comments

Sign in to comment.