update_repo's description changes the repository's project again (#52): since descriptions became the project's (#45), update_repo still listed description and passed it to the repos service, which no longer takes it, so a description given there was dropped without a word. It now sets the repository's own project's description through the projects service's describe, as create_repo already does and as update_project would, after the repository's other fields change; "" clears it, it needs the Maintain role like update_project, and a refusal from projects is the answer. Its schema, the operation's description, the MCP repository tool's update action, the reference notes and Managing a repository say so; the OpenAPI copy is regenerated.
- Checked:
- cargo test -p g1t-api (208, with and without G1T_WRITE_OPENAPI), cargo test -p g1t ops_table.
- G1t-Session:
- ses_01m4ynr1peevvs8zwaqakycv2e
5 files+24−60/5 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.
Comments
Sign in to comment.