Merge branch 'worktree-agent-ae4528f3b3dc72f27'
6 files+44−120/6 viewed
| 1533 | 1533 | Op::ListRepos => "Repositories you can see, optionally filtered by a search query.", | |
| 1534 | 1534 | Op::GetRepo => "One repository's details.", | |
| 1535 | 1535 | 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." | |
| 1537 | 1537 | } | |
| 1538 | 1538 | Op::RenameRepo => { | |
| 1539 | 1539 | "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." | |
| ⋯ | |||
| 2370 | 2370 | Op::UpdateRepo => object( | |
| 2371 | 2371 | json!({ | |
| 2372 | 2372 | "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." }, | |
| 2374 | 2374 | "private": { "type": "boolean" }, | |
| 2375 | 2375 | "protected": { | |
| 2376 | 2376 | "type": "boolean", | |
| ⋯ | |||
| 4588 | 4588 | &json!({ | |
| 4589 | 4589 | "actor": actor(), | |
| 4590 | 4590 | "path": repo, | |
| 4591 | − | "description": input["description"].as_str(), | |
| 4592 | 4591 | "isPrivate": input["private"].as_bool(), | |
| 4593 | 4592 | "protected": input["protected"].as_bool(), | |
| 4594 | 4593 | "topics": strings(input, "topics"), | |
| ⋯ | |||
| 4599 | 4598 | }), | |
| 4600 | 4599 | ) | |
| 4601 | 4600 | .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 | + | }; | |
| 4602 | 4618 | // A new default branch, once the rest has been changed. | |
| 4603 | 4619 | match (&updated, optional_text(input, "default_branch")) { | |
| 4604 | 4620 | (Outcome::Ok(_), Some(branch)) => { | |
| 702 | 702 | "website": "https://hello.g1t.page", | |
| 703 | 703 | "archived_at": null | |
| 704 | 704 | }, | |
| 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/)." | |
| 706 | 706 | }, | |
| 707 | 707 | "transfer_repo": { | |
| 708 | 708 | "request": { |
| 86 | 86 | a("tarball", Op::Archives(ArchiveOp::DownloadTarball), "A 10-minute link to a branch, tag or commit as a .tar.gz"), | |
| 87 | 87 | a("zipball", Op::Archives(ArchiveOp::DownloadZipball), "A 10-minute link to a branch, tag or commit as a .zip"), | |
| 88 | 88 | 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"), | |
| 90 | 90 | a("get_settings", Op::GetRepoSettings, "How pull requests merge, and the default branch's protection as its rules stack"), | |
| 91 | 91 | a("update_settings", Op::UpdateRepoSettings, "Change how pull requests merge and the default branch protection ruleset"), | |
| 92 | 92 | a("check_names", Op::ListCheckNames, "Check names reported lately, to require in a ruleset"), |
| 21 | 21 | [project](/guides/projects/) has, and search, link previews and lists of | |
| 22 | 22 | repositories show that one. Change it in the project's **Settings → | |
| 23 | 23 | 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). | |
| 25 | 27 | ||
| 26 | 28 | The **Code** page shows its files with its facts beside them. On a phone | |
| 27 | 29 | they come after the files. |
Binary or large file; its contents are not shown.
| 726 | 726 | if let Some(home) = &home { | |
| 727 | 727 | folders.push(home.join(".g1t-runner")); | |
| 728 | 728 | } | |
| 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(), | |
| 734 | 737 | }; | |
| 735 | − | if let Some(data) = data { | |
| 738 | + | for data in data { | |
| 736 | 739 | folders.push(data.join("sh.g1t.desktop").join("runner").join("host")); | |
| 737 | 740 | } | |
| 738 | 741 | folders.dedup(); | |
| ⋯ | |||
| 1348 | 1351 | assert!(said.contains("as you") && said.contains("g1t-runner remove --dir"), "{said}"); | |
| 1349 | 1352 | // The desktop app's folder for running jobs directly is looked at. | |
| 1350 | 1353 | 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 | + | } | |
| 1351 | 1365 | // An older status, without warnings, still reads. | |
| 1352 | 1366 | 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(); | |
| 1353 | 1367 | assert!(old.warnings.is_empty()); | |
Comments
Sign in to comment.