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.

Upgrade rustls to 0.23.46 #39

Mergedsyntaqx merged g1t/security/rustls-0.23.46 into maindependenciesrust

Approved by syntaqx

153 files+104−1630137 files not counted0/153 viewed
+2−2
33983398
33993399 [[package]]
34003400 name = "rustls"
3401−version = "0.23.45"
3401+version = "0.23.46"
34023402 source = "registry+https://github.com/rust-lang/crates.io-index"
3403−checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
3403+checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
34043404 dependencies = [
34053405 "aws-lc-rs",
34063406 "log",
+2−41
132132 Op::ArchiveRepo,
133133 Op::UnarchiveRepo,
134134 Op::TransferRepo,
135− Op::ForkRepo,
136− Op::ListForks,
137− Op::SyncFork,
138− Op::DetachFork,
139135 Op::DeleteRepo,
140136 Op::ListDeletedRepos,
141137 Op::RestoreRepo,
145141 Op::ListCheckNames,
146142 Op::GetCodeownersErrors,
147143 Op::ListEvents,
148− ],
149− ),
150− (
151− "Commit comments",
152− "Comments on a commit, as a whole or on one line of a file it changed. Anyone who can read a repository reads them, and may comment unless the repository turned commit comments off.",
153− &[
154− Op::ListRepoCommitComments,
155− Op::ListCommitComments,
156− Op::CreateCommitComment,
157− Op::UpdateCommitComment,
158− Op::DeleteCommitComment,
159144 ],
160145 ),
161146 (
275260 Op::Security(SecurityOp::GetDependencyGraph),
276261 Op::Security(SecurityOp::GetSbom),
277262 Op::Security(SecurityOp::CompareDependencies),
278− Op::Security(SecurityOp::RerunDependencyReview),
279263 ],
280264 ),
281265 (
388372 ),
389373 (
390374 "Pull requests",
391− "A proposed change in its own fork or on a branch. Several can be made for one issue; the one merged resolves it. It merges by a merge commit, a squash, a rebase or a fast-forward, now or with auto-merge once everything it needs is met.",
375+ "A proposed change in its own fork or on a branch. Several can be made for one issue; the one merged resolves it.",
392376 &[
393377 Op::ListPullRequests,
394378 Op::CreatePullRequest,
400384 Op::RequestReviewers,
401385 Op::RemoveRequestedReviewers,
402386 Op::ReviewPullRequest,
403− Op::GetPullRequestMergeOptions,
404387 Op::MergePullRequest,
405− Op::UpdatePullRequestBranch,
406− Op::EnablePullRequestAutoMerge,
407− Op::DisablePullRequestAutoMerge,
408− Op::DeletePullRequestHeadBranch,
409− Op::RestorePullRequestHeadBranch,
410388 Op::ClosePullRequest,
411389 Op::ReopenPullRequest,
412390 Op::GetMergeQueue,
541519 Op::Protection(ProtectionOp::SetForkPrApproval),
542520 Op::Protection(ProtectionOp::GetActionsAccess),
543521 Op::Protection(ProtectionOp::SetActionsAccess),
544− Op::Protection(ProtectionOp::GetActionsPermissions),
545− Op::Protection(ProtectionOp::SetActionsPermissions),
546522 Op::Protection(ProtectionOp::CreateRepositoryDispatch),
547523 Op::Protection(ProtectionOp::GetWorkspaceWorkflowPermissions),
548524 Op::Protection(ProtectionOp::SetWorkspaceWorkflowPermissions),
680656 Op::DeclineInvitation => "Decline a workspace invitation",
681657 Op::RevokeWorkspaceInvite => "Revoke a workspace's invite",
682658 Op::TransferRepo => "Transfer a repository",
683− Op::ForkRepo => "Fork a repository",
684− Op::ListForks => "List forks",
685− Op::SyncFork => "Sync a fork",
686− Op::DetachFork => "Detach a fork",
687659 Op::RenameRepo => "Rename a repository",
688660 Op::RenameBranch => "Rename a branch",
689661 Op::CreateBranch => "Create a branch",
743715 Op::ConvertPullRequestToDraft => "Convert a pull request to a draft",
744716 Op::GetPullRequestChanges => "Get a pull request's changes",
745717 Op::MergePullRequest => "Merge a pull request",
746− Op::GetPullRequestMergeOptions => "Get a pull request's merge options",
747− Op::UpdatePullRequestBranch => "Update a pull request's branch",
748− Op::EnablePullRequestAutoMerge => "Enable auto-merge",
749− Op::DisablePullRequestAutoMerge => "Disable auto-merge",
750− Op::DeletePullRequestHeadBranch => "Delete a pull request's branch",
751− Op::RestorePullRequestHeadBranch => "Restore a pull request's branch",
752− Op::ListRepoCommitComments => "List a repository's commit comments",
753− Op::ListCommitComments => "List a commit's comments",
754− Op::CreateCommitComment => "Comment on a commit",
755− Op::UpdateCommitComment => "Edit a commit comment",
756− Op::DeleteCommitComment => "Delete a commit comment",
757718 Op::ListEvents => "List repository events",
758719 Op::ListIntegrations => "List integrations",
759720 Op::ConnectIntegration => "Connect an integration",
884845 /// free workspace's private storage has no room for it.
885846 fn may_need_payment(op: Op) -> Option<&'static str> {
886847 match op {
887− Op::UpdateRepo | Op::SetRepoVisibility | Op::TransferRepo | Op::ForkRepo => Some(
848+ Op::UpdateRepo | Op::SetRepoVisibility | Op::TransferRepo => Some(
888849 "A free workspace's private storage has no room for this private repository.",
889850 ),
890851 _ => None,
+10−606
1313 use g1t_contracts::identity::AgentScope;
1414 use g1t_contracts::events::Event;
1515 use g1t_contracts::identity::{CreateWorkspaceArgs, UpdateWorkspaceArgs, Workspace};
16−use g1t_contracts::repos::{
17− CreateArgs, DetachForkArgs, ForkRepoArgs, ForksArgs, GetArgs, ListArgs as ListReposArgs, Repo, RepoPath, SyncForkArgs,
18−};
16+use g1t_contracts::repos::{CreateArgs, GetArgs, ListArgs as ListReposArgs, Repo, RepoPath};
1917 use g1t_contracts::teams::{
2018 CreateTeamArgs, DeleteTeamArgs, ListTeamsArgs, RemoveTeamMemberArgs, RemoveTeamRepoArgs, ReviewAlgorithm,
2119 ReviewAssignment, SetTeamCreationArgs, SetTeamMemberArgs, SetTeamRepoArgs, Team, TeamArgs, TeamCreation, TeamRole,
4442 use crate::rules::RulesOp;
4543 use crate::security::SecurityOp;
4644 use g1t_contracts::inbox::{Reason, Severity, WATCH_EVENTS, WatchLevel};
47−use g1t_contracts::repos::UpdateMethod;
48−use g1t_contracts::rules::MergeMethod;
4945 use g1t_contracts::work::*;
5046 use g1t_contracts::{FailureCode, Outcome, Viewer};
5147 use serde::Serialize;
146142 CreateRepo,
147143 UpdateRepo,
148144 TransferRepo,
149− ForkRepo,
150− ListForks,
151− SyncFork,
152− DetachFork,
153145 RenameRepo,
154146 RenameBranch,
155147 CreateBranch,
205197 ReopenPullRequest,
206198 GetPullRequestChanges,
207199 MergePullRequest,
208− GetPullRequestMergeOptions,
209− UpdatePullRequestBranch,
210− EnablePullRequestAutoMerge,
211− DisablePullRequestAutoMerge,
212− DeletePullRequestHeadBranch,
213− RestorePullRequestHeadBranch,
214− ListRepoCommitComments,
215− ListCommitComments,
216− CreateCommitComment,
217− UpdateCommitComment,
218− DeleteCommitComment,
219200 ListEvents,
220201 ListIntegrations,
221202 ConnectIntegration,
499480 "type": "string",
500481 "description": "The comment's id, such as \"cmt_01J9Z8\": each comment's id in get_issue or get_pull_request.",
501482 })
502−}
503−
504−fn commit_sha_schema() -> Value {
505− json!({ "type": "string", "description": "The commit's hash, as list_commits gives it." })
506483 }
507484
508−fn commit_comment_id_schema() -> Value {
509− json!({
510− "type": "string",
511− "description": "The commit comment's id, as list_commit_comments and list_repo_commit_comments give it.",
512− })
513−}
514−
515485 fn workspace_schema() -> Value {
516486 json!({ "type": "string", "description": "The workspace's slug, e.g. \"flagon-io\"." })
517487 }
755725 properties
756726 }
757727
758−/// How a pull request merges.
759−fn merge_method_schema(description: &str) -> Value {
760− json!({
761− "type": "string",
762− "enum": MergeMethod::ALL.map(MergeMethod::as_str),
763− "description": description,
764− })
765−}
766−
767−/// A merge method given by name, if one was given: `Err` names the ones
768−/// there are.
769−fn merge_method(input: &Value, key: &str) -> std::result::Result<Option<MergeMethod>, String> {
770− match input[key].as_str().map(str::trim).filter(|given| !given.is_empty()) {
771− None => Ok(None),
772− Some(given) => MergeMethod::ALL
773− .into_iter()
774− .find(|method| method.as_str().eq_ignore_ascii_case(given))
775− .map(Some)
776− .ok_or_else(|| format!("{key} must be merge, squash, rebase or fast_forward, not {given}.")),
777− }
778−}
779−
780−/// What a merge or squash commit says by default.
781−const COMMIT_MESSAGE_DEFAULTS: [(&str, CommitMessageDefault); 5] = [
782− ("default", CommitMessageDefault::Default),
783− ("pull_title", CommitMessageDefault::PullTitle),
784− ("pull_title_and_description", CommitMessageDefault::PullTitleAndDescription),
785− ("pull_title_and_commits", CommitMessageDefault::PullTitleAndCommits),
786− ("custom", CommitMessageDefault::Custom),
787−];
788−
789−fn commit_message_default(input: &Value, key: &str) -> std::result::Result<Option<CommitMessageDefault>, String> {
790− match input[key].as_str().map(str::trim).filter(|given| !given.is_empty()) {
791− None => Ok(None),
792− Some(given) => COMMIT_MESSAGE_DEFAULTS
793− .iter()
794− .find(|(name, _)| name.eq_ignore_ascii_case(given))
795− .map(|(_, value)| Some(*value))
796− .ok_or_else(|| {
797− format!("{key} must be default, pull_title, pull_title_and_description, pull_title_and_commits or custom, not {given}.")
798− }),
799− }
800−}
801−
802728 fn alert_id_schema() -> Value {
803729 json!({
804730 "type": "string",
807733 }
808734
809735 impl Op {
810− pub const ALL: [Op; 403] = [
736+ pub const ALL: [Op; 385] = [
811737 Op::Whoami,
812738 Op::GetWorkspace,
813739 Op::CreateWorkspace,
838764 Op::CreateRepo,
839765 Op::UpdateRepo,
840766 Op::TransferRepo,
841− Op::ForkRepo,
842− Op::ListForks,
843− Op::SyncFork,
844− Op::DetachFork,
845767 Op::RenameRepo,
846768 Op::RenameBranch,
847769 Op::CreateBranch,
897819 Op::ReopenPullRequest,
898820 Op::GetPullRequestChanges,
899821 Op::MergePullRequest,
900− Op::GetPullRequestMergeOptions,
901− Op::UpdatePullRequestBranch,
902− Op::EnablePullRequestAutoMerge,
903− Op::DisablePullRequestAutoMerge,
904− Op::DeletePullRequestHeadBranch,
905− Op::RestorePullRequestHeadBranch,
906− Op::ListRepoCommitComments,
907− Op::ListCommitComments,
908− Op::CreateCommitComment,
909− Op::UpdateCommitComment,
910− Op::DeleteCommitComment,
911822 Op::ListEvents,
912823 Op::ListIntegrations,
913824 Op::ConnectIntegration,
1040951 Op::Security(SecurityOp::GetDependencyGraph),
1041952 Op::Security(SecurityOp::GetSbom),
1042953 Op::Security(SecurityOp::CompareDependencies),
1043− Op::Security(SecurityOp::RerunDependencyReview),
1044954 Op::Security(SecurityOp::GetSettings),
1045955 Op::Security(SecurityOp::UpdateSettings),
1046956 Op::Security(SecurityOp::GetWorkspaceSettings),
11501060 Op::Protection(ProtectionOp::SetForkPrApproval),
11511061 Op::Protection(ProtectionOp::GetActionsAccess),
11521062 Op::Protection(ProtectionOp::SetActionsAccess),
1153− Op::Protection(ProtectionOp::GetActionsPermissions),
1154− Op::Protection(ProtectionOp::SetActionsPermissions),
11551063 Op::Protection(ProtectionOp::CreateRepositoryDispatch),
11561064 Op::Protection(ProtectionOp::GetWorkspaceWorkflowPermissions),
11571065 Op::Protection(ProtectionOp::SetWorkspaceWorkflowPermissions),
12501158 Op::CreateRepo => "create_repo",
12511159 Op::UpdateRepo => "update_repo",
12521160 Op::TransferRepo => "transfer_repo",
1253− Op::ForkRepo => "fork_repo",
1254− Op::ListForks => "list_forks",
1255− Op::SyncFork => "sync_fork",
1256− Op::DetachFork => "detach_fork",
12571161 Op::RenameRepo => "rename_repo",
12581162 Op::RenameBranch => "rename_branch",
12591163 Op::CreateBranch => "create_branch",
13091213 Op::ConvertPullRequestToDraft => "convert_pull_request_to_draft",
13101214 Op::GetPullRequestChanges => "get_pull_request_changes",
13111215 Op::MergePullRequest => "merge_pull_request",
1312− Op::GetPullRequestMergeOptions => "get_pull_request_merge_options",
1313− Op::UpdatePullRequestBranch => "update_pull_request_branch",
1314− Op::EnablePullRequestAutoMerge => "enable_pull_request_auto_merge",
1315− Op::DisablePullRequestAutoMerge => "disable_pull_request_auto_merge",
1316− Op::DeletePullRequestHeadBranch => "delete_pull_request_head_branch",
1317− Op::RestorePullRequestHeadBranch => "restore_pull_request_head_branch",
1318− Op::ListRepoCommitComments => "list_repo_commit_comments",
1319− Op::ListCommitComments => "list_commit_comments",
1320− Op::CreateCommitComment => "create_commit_comment",
1321− Op::UpdateCommitComment => "update_commit_comment",
1322− Op::DeleteCommitComment => "delete_commit_comment",
13231216 Op::ListEvents => "list_events",
13241217 Op::ListIntegrations => "list_integrations",
13251218 Op::ConnectIntegration => "connect_integration",
15231416 Op::ListRepos => "Repositories you can see, optionally filtered by a search query.",
15241417 Op::GetRepo => "One repository's details.",
15251418 Op::UpdateRepo => {
1526− "Change a repository's description, 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 description, 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)."
1419+ "Change a repository's description, website, topics and default branch, whether its default branch is protected, and whether it is private. Only the fields given are changed. Its description, website and topics need the Maintain role or higher; protecting its default branch, making it public or private 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."
15271420 }
15281421 Op::RenameRepo => {
15291422 "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."
15601453 }
15611454 Op::TransferRepo => {
15621455 "Move a repository to another workspace, keeping its name. You must own both workspaces, and the destination must not already have a repository of that name; a free destination takes a private repository only if its private storage has room. Everything moves with it: git data, issues, pull requests, comments, labels, workflow runs, deployments, its project, and its own secrets, variables 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. Usage from now on is charged to the new workspace."
1563− }
1564− Op::ForkRepo => {
1565− "Fork a repository: copy it into a workspace you can create repositories in, as a new repository that remembers the one it came from (its parent). Anyone who can read a public repository may fork it; a private one only when its admins allow forking (allow_forking on update_repo). A fork is exactly as visible as its parent: a public repository's fork is public, a private one's private. Only its code and description come with it: the default branch, or every branch and tag with default_branch_only false. Its issues, pull requests, settings, rulesets, secrets, variables, webhooks, environments and deployments stay behind; issues are off in the fork, and Actions is off until an admin of the fork turns it on. Its full size counts toward the destination workspace's storage, and a free workspace takes a private fork only while its private storage has room. workspace is the destination's slug: your personal workspace when left out. name is the parent's when left out. Returns the fork, with parent naming the repository it came from."
15661456 }
1567− Op::ListForks => {
1568− "A repository's forks that you can see, newest first, each with parent naming the repository. limit is at most 100, 30 when left out. Forks of its forks are listed on them."
1569− }
1570− Op::SyncFork => {
1571− "Bring a fork's branch up to date with its parent: branch (the fork's default branch when left out) takes in the parent's branch of the same name, or the parent's default branch for the fork's default branch. Needs the Write role on the fork and read access to its parent. A branch that is only behind moves forward (fast_forwarded); one with commits of its own gets a merge commit when the two sides' changes do not clash, edits to the same file merging line by line (merged); when both changed the same lines (or one deleted a file the other changed, or both changed a binary file) nothing is changed (conflicted, with the files in conflicts, at most 20): merge the parent's branch in a clone and push, or open a pull request. Returns status, branch, head (the branch's commit afterwards), behind and ahead (the commits each side had that the other lacked)."
1572− }
1573− Op::DetachFork => {
1574− "Detach a fork from its parent: it becomes an ordinary repository with no parent, and can then be made public or private. Needs the Admin role on the fork. Its code, settings, and the pull requests it already opened into the parent stay as they are; it can no longer be synced or open new pull requests into the parent. It cannot be attached again."
1575− }
15761457 Op::GetRepoSettings => {
1577− "How a repository handles pull requests, commits and issues: the merge methods it allows and the one offered first, what merge and squash commits say by default (merge_commit_message, squash_commit_message, and the templates for custom), whether pull requests may turn on auto-merge, whether their branches are deleted once merged, whether to suggest updating branches, whether web commits are signed off, whether commit comments are allowed, whether merged pull requests close the issues they name, and whether issues can be opened (issues_enabled); also whether they merge by themselves, and its default branch's protection as the rules of its rulesets stack there: the checks that must pass (required_checks), the approvals a merge needs, whether its code owners must approve (`require_code_owner_review`), whether required checks can be bypassed, whether a pull request must be up to date, and the merge queue. The same rules hold for every pull request, whoever opened it. list_repo_rulesets and get_branch_rules show every rule."
1458+ "How a repository handles pull requests: whether they merge by themselves, and its default branch's protection as the rules of its rulesets stack there: the checks that must pass (required_checks), the approvals a merge needs, whether its code owners must approve (`require_code_owner_review`), whether required checks can be bypassed, whether a pull request must be up to date, and the merge queue. The same rules hold for every pull request, whoever opened it. list_repo_rulesets and get_branch_rules show every rule."
15781459 }
15791460 Op::UpdateRepoSettings => {
1580− "Change how a repository handles pull requests, commits and issues. Only the fields given are changed; required_checks replaces the whole list. At least one merge method must stay allowed, and default_merge_method must be one of them. A custom commit message (merge_commit_message or squash_commit_message custom) uses its template, whose {title}, {number}, {body}, {branch}, {head_repo}, {base}, {author}, {commits}, {issues} and {co_authors} are filled in; pull_title_and_commits is for squash commits only. The branch protection fields (required_checks, require_up_to_date, required_approvals, count_agent_approvals, allow_ignoring_checks, merge_queue, require_code_owner_review) are written to the repository's \"Default branch protection\" ruleset, made when it has none; rules only rulesets have stay as they are. A required check is named as list_check_names gives it: a workflow's name, such as CI, or another status's context, such as g1t / deploy. Needs the Maintain role or higher, and the Admin role to change a branch protection field."
1461+ "Change how a repository handles pull requests. Only the fields given are changed; required_checks replaces the whole list. The branch protection fields (required_checks, require_up_to_date, required_approvals, count_agent_approvals, allow_ignoring_checks, merge_queue, require_code_owner_review) are written to the repository's \"Default branch protection\" ruleset, made when it has none; rules only rulesets have stay as they are. A required check is named as list_check_names gives it: a workflow's name, such as CI, or another status's context, such as g1t / deploy. Needs the Maintain role or higher, and the Admin role to change a branch protection field."
15811462 }
15821463 Op::ListCheckNames => {
15831464 "The check names reported on a repository's commits in the last 30 days, most recent first, with the events each was reported for: the names update_repo_settings takes in required_checks. A workflow's runs report a check named after the workflow; a check required on the default branch must be reported on a pull request's head (pull_request events) and, with the merge queue on, on its queued state (merge_group events)."
16941575 "What a pull request changes: the files it touches and their line-by-line diff against the commit it started from. Use it to review a pull request or to compare several made for the same issue. A large one lists every file (up to 300; truncated says when there were more) but has the lines of only the first, about 20,000 lines read: the files after that come with omitted true and no lines or counts. Ask again with paths (up to 50 at a time) to have those files' lines."
16951576 }
16961577 Op::MergePullRequest => {
1697− "Land a pull request on its base, the branch it merges into (the default branch unless it names another). merge_method says how: merge (a merge commit joins its branch to the base, its commits included), squash (one new commit holds everything it changed), rebase (each of its commits is made again on top of the base, in order) or fast_forward (the base moves to its head, exactly the commit that was checked; only when its branch contains the base's head). Left out, the repository's default_merge_method. A method the repository does not allow (allow_merge_commit, allow_squash_merge, allow_rebase_merge, allow_fast_forward on update_repo_settings), or that a rule for the base does not (allowed_merge_methods, and required linear history, which refuses merge), is refused. commit_title and commit_message are a merge or squash commit's message: its first line and the rest; left out, the repository's merge_commit_message or squash_commit_message decides. With sha, the merge is refused (409) if the pull request's head is no longer that commit. delete_branch deletes its branch once it has merged (left out, the repository's delete_branch_on_merge); restore_pull_request_head_branch brings it back. Merging needs the Write role or higher, and only once it is marked ready and it meets every rule that holds for its base (see rules and required_checks on get_pull_request: approvals, checks, deployments, merge windows and the rest, from the repository's and its workspace's rulesets); the refusal names the first rule not met. With ignore_checks, someone who may merge can bypass required checks where the rule allows it; with bypass_rules, someone a ruleset lists as a bypass actor merges past its rules, and it is recorded. Merging into the default branch closes the issues in its closes: the issue it was made for and those its title and description name after a closing keyword (Fixes #12), where the repository closes issues (auto_close_issues); the other pull requests still in progress for its issue close as superseded. Merging into another branch closes nothing. Where the repository has a merge queue, a pull request into the default branch joins the queue instead of landing at once. If its base has moved since the pull request was opened, it is brought up to date first and lands when that is done; a repository that requires pull requests into its default branch to be up to date refuses instead: update_pull_request_branch, then merge again. Check status in the result to see whether it has landed, and merge_method and merge_commit for how."
1698− }
1699− Op::GetPullRequestMergeOptions => {
1700− "How a pull request may merge now, as the merge box offers it to you: the methods it may merge by (the repository's, as the rules for its base allow them) and the one offered first (default_method); each method's default commit title and message, and why one cannot be used now (unavailable); whether it is behind its base, can fast-forward as it is, should be offered an update (suggest_update) or must be up to date (require_up_to_date); whether it goes through the merge queue; whether you may turn on auto-merge; whether deleting its branch starts ticked and is possible; and whether commits made merging it are signed off."
1701− }
1702− Op::UpdatePullRequestBranch => {
1703− "Bring a pull request's branch up to date with its base: update_method merge (the default) makes a merge commit on its branch that takes in the base's new commits; rebase makes each of its commits again on top of the base's head and moves its branch there, rewriting its history. Pushed as you, so you must be able to push to its branch: the Write role for a branch of the repository, its owner for a working copy, and push access to the fork for a branch of a fork. With expected_head_sha, refused (409) if its head is no longer that commit. Edits to the same file merge line by line; a rebase drops merge commits and commits the base already has, keeps authors, dates and messages, and moves its branch only if its head is still where it was. Returns outcome: updated (with commit, its head now, and previous), up_to_date, or needs_agent when both sides changed the same lines (with reason, detail and the paths): nothing was pushed, so merge or rebase in a clone and push."
1704− }
1705− Op::EnablePullRequestAutoMerge => {
1706− "Turn on auto-merge for a pull request: it merges on its own, as you, once its required checks, reviews and rules allow, with merge_method (the repository's default when left out) and, for merge and squash, commit_title and commit_message. Needs the Write role, since it merges as you, and a repository that allows auto-merge (allow_auto_merge). A method the repository or a rule for its base does not allow is refused. A pull request that may merge already merges at once instead. Auto-merge is turned off when it merges or closes, when someone turns it off, and when someone other than whoever turned it on pushes to it. Publishes pull.auto_merge_enabled. Returns the pull request, with auto_merge saying how and who asked."
1707− }
1708− Op::DisablePullRequestAutoMerge => {
1709− "Turn off auto-merge for a pull request: it waits for someone to merge it. Needs the Write role, or to be its author. Publishes pull.auto_merge_disabled. Returns the pull request, with auto_merge null."
1710− }
1711− Op::DeletePullRequestHeadBranch => {
1712− "Delete a merged or closed pull request's branch: a branch of the repository, or of a fork you can push to. Needs the Write role (push access to the fork, for a fork's branch). Refused while the pull request is open, for the default branch, for a branch an open pull request still uses, and where rules protect it. head_branch_deleted is then true, and restore_pull_request_head_branch makes it again at its head. Publishes pull.head_branch_deleted. Returns the pull request."
1713− }
1714− Op::RestorePullRequestHeadBranch => {
1715− "Make a pull request's deleted branch again, at the pull request's head commit (head_commit). Needs the Write role (push access to the fork, for a fork's branch). Refused when a branch of that name exists again. Publishes pull.head_branch_restored. Returns the pull request."
1716− }
1717− Op::ListRepoCommitComments => {
1718− "A repository's commit comments, newest first, 30 a page (page from 1). Each names its commit; one on a line of a file has path and line. Anyone who can read the repository can read them."
1719− }
1720− Op::ListCommitComments => {
1721− "A commit's comments, oldest first: on the whole commit, or on one line of a file it changed (path and line). sha is the commit's hash. Anyone who can read the repository can read them."
1722− }
1723− Op::CreateCommitComment => {
1724− "Comment on a commit, as a whole or, with path and line, on one line of a file the commit changed (a line of the file as the commit left it). Anyone who can read the repository may, unless it has turned commit comments off (allow_commit_comments on update_repo_settings). The commit's author and anyone mentioned are notified. Publishes commit_comment.created."
1725− }
1726− Op::UpdateCommitComment => {
1727− "Change a commit comment's text, named by comment_id. Its author only. Publishes commit_comment.edited."
1728− }
1729− Op::DeleteCommitComment => {
1730− "Delete a commit comment, named by comment_id. Its author may, and so may anyone with the Maintain role or higher. This cannot be undone. Publishes commit_comment.deleted."
1578+ "Land a pull request on its base, the branch it merges into (the default branch unless it names another). Merging needs the Write role or higher, and only once it is marked ready and it meets every rule that holds for its base (see rules and required_checks on get_pull_request: approvals, checks, deployments, merge windows and the rest, from the repository's and its workspace's rulesets); the refusal names the first rule not met. With ignore_checks, someone who may merge can bypass required checks where the rule allows it; with bypass_rules, someone a ruleset lists as a bypass actor merges past its rules, and it is recorded. Merging into the default branch resolves the issue it was made for: the issue closes recording this pull request, and the other pull requests still in progress for that issue close as superseded; merging into another branch leaves the issue open. Where the repository has a merge queue, a pull request into the default branch joins the queue instead of landing at once. If its base has moved since the pull request was opened, it is brought up to date first and lands when that is done; a repository that requires pull requests into its default branch to be up to date refuses instead, so pull the base into its fork or branch, push, and merge again. Check status in the result to see whether it has landed."
17311579 }
17321580 Op::ListEvents => {
17331581 "The timeline of a repository: pushes, issues, pull requests, comments, sessions, claims and integration results, newest first; page back with before. To follow it, give after (an event id): the events written after that one come oldest first, and the last one's id is the next call's after. With after and wait (seconds, at most 25), a call that finds nothing holds on until a matching event is written or the wait ends, then returns what it has, perhaps nothing. Narrow it with types, numbers (issues and pull requests, matching events about them and comments on them), since and limit (50 by default, at most 200)."
22592107 }),
22602108 &["repo", "to"],
22612109 ),
2262− Op::ForkRepo => object(
2263− json!({
2264− "repo": repo_schema(),
2265− "workspace": {
2266− "type": "string",
2267− "description": "The slug of the workspace to fork it into, e.g. \"flagon-io\". Your personal workspace when left out.",
2268− },
2269− "name": { "type": "string", "description": "The fork's name; the repository's own when left out." },
2270− "description": { "type": "string", "description": "The fork's description; the repository's own when left out, none when empty." },
2271− "default_branch_only": {
2272− "type": "boolean",
2273− "description": "Copy only the default branch (the default). false copies every branch and tag.",
2274− },
2275− }),
2276− &["repo"],
2277− ),
2278− Op::ListForks => object(
2279− json!({
2280− "repo": repo_schema(),
2281− "limit": { "type": "integer", "minimum": 1, "maximum": 100, "description": "At most this many; 30 when left out." },
2282− }),
2283− &["repo"],
2284− ),
2285− Op::SyncFork => object(
2286− json!({
2287− "repo": repo_schema(),
2288− "branch": { "type": "string", "description": "The fork's branch to sync; its default branch when left out." },
2289− }),
2290− &["repo"],
2291− ),
2292− Op::DetachFork => repo_only(),
22932110 Op::GetRepo | Op::ListLabels | Op::AddDefaultLabels => repo_only(),
22942111 Op::CreateLabel => object(
22952112 json!({
23762193 "default_branch": {
23772194 "type": "string",
23782195 "description": "Make this existing branch the default: the one clones check out and pull requests merge into.",
2379− },
2380− "allow_forking": {
2381− "type": "boolean",
2382− "description": "Let people who can read this private repository fork it; their forks stay private. Public repositories can always be forked.",
23832196 },
2384− "max_ref_updates": {
2385− "type": "integer",
2386− "minimum": 0,
2387− "maximum": 1000,
2388− "description": "The most branches and tags one push may change, 1 to 1,000; a push that would change more is declined whole. 0 for no limit.",
2389− },
23902197 }),
23912198 &["repo"],
23922199 ),
25152322 "require_code_owner_review": {
25162323 "type": "boolean",
25172324 "description": "Refuse to merge until the code owners of every file a pull request changes, as the CODEOWNERS file of the branch it merges into names them, have approved it, as many as each section asks. Only people's approvals count, and g1t's only where the file names @g1t.",
2518− },
2519− "allow_merge_commit": {
2520− "type": "boolean",
2521− "description": "Let pull requests merge with a merge commit (merge). At least one method stays allowed.",
2522− },
2523− "allow_squash_merge": {
2524− "type": "boolean",
2525− "description": "Let pull requests merge as one squashed commit (squash).",
2526− },
2527− "allow_rebase_merge": {
2528− "type": "boolean",
2529− "description": "Let pull requests merge by making each of their commits again on the base (rebase).",
2530− },
2531− "allow_fast_forward": {
2532− "type": "boolean",
2533− "description": "Let pull requests merge by moving the base to their head, with no new commit (fast_forward). Off unless turned on.",
2534− },
2535− "default_merge_method": merge_method_schema("The method offered first, and used when a merge names none. Must be allowed."),
2536− "merge_commit_message": {
2537− "type": "string",
2538− "enum": ["default", "pull_title", "pull_title_and_description", "custom"],
2539− "description": "What a merge commit says unless its merger writes it: default (\"Merge pull request #12 from owner/branch\" and its title), pull_title (its title, with its number), pull_title_and_description (and its description below), or custom (merge_commit_template).",
2540− },
2541− "squash_commit_message": {
2542− "type": "string",
2543− "enum": ["default", "pull_title", "pull_title_and_description", "pull_title_and_commits", "custom"],
2544− "description": "What a squash commit says unless its merger writes it: default (its title for one commit, else its title and the commits' messages), pull_title, pull_title_and_description, pull_title_and_commits (its title, and each commit's message below), or custom (squash_commit_template).",
2545− },
2546− "merge_commit_template": {
2547− "type": "string",
2548− "description": "With merge_commit_message custom: the message, its first line the title. {title}, {number}, {body}, {branch}, {head_repo}, {base}, {author}, {commits}, {issues} and {co_authors} are filled in. An empty string clears it.",
2549− },
2550− "squash_commit_template": {
2551− "type": "string",
2552− "description": "With squash_commit_message custom: the message, with the same placeholders as merge_commit_template. An empty string clears it.",
2553− },
2554− "suggest_updating_branches": {
2555− "type": "boolean",
2556− "description": "Offer to update a pull request's branch whenever its base has new commits, not only when it must be up to date to merge.",
2557− },
2558− "allow_auto_merge": {
2559− "type": "boolean",
2560− "description": "Let people turn on auto-merge for a pull request, so it merges on its own once everything it needs is met.",
25612325 },
2562− "delete_branch_on_merge": {
2563− "type": "boolean",
2564− "description": "Delete a pull request's branch once it merges. It can be restored from the pull request.",
2565− },
2566− "require_web_commit_sign_off": {
2567− "type": "boolean",
2568− "description": "Commits made on g1t (web edits, merge and squash commits) carry a Signed-off-by: trailer for whoever made them.",
2569− },
2570− "allow_commit_comments": {
2571− "type": "boolean",
2572− "description": "Let anyone who can read the repository comment on its commits. Existing comments stay readable either way.",
2573− },
2574− "auto_close_issues": {
2575− "type": "boolean",
2576− "description": "Close the issues a pull request names (its issue, and Fixes #12 in its title or description) when it merges into the default branch.",
2577− },
2578− "has_issues": {
2579− "type": "boolean",
2580− "description": "Whether issues can be opened in it. null goes back to the default: on for a repository, off for a fork. Existing issues stay readable either way.",
2581− },
25822326 }),
25832327 &["repo"],
25842328 ),
27712515 },
27722516 "branch": {
27732517 "type": "string",
2774− "description": "A branch already pushed to the repository (or to head_repo) that holds the change. Leave out to get a fork.",
2775− },
2776− "head_repo": {
2777− "type": "string",
2778− "description": "A fork of the repository, \"owner/name\", whose branch holds the change: to propose a change from your fork. Needs branch.",
2518+ "description": "A branch already pushed to the repository that holds the change. Leave out to get a fork.",
27792519 },
27802520 "body": {
27812521 "type": "string",
28612601 "bypass_rules": {
28622602 "type": "boolean",
28632603 "description": "Merge although rules are not met, where a ruleset lists you as one who may bypass it. Recorded as a bypass in its evaluations.",
2864− },
2865− "merge_method": merge_method_schema("How to merge: merge, squash, rebase or fast_forward. The repository's default_merge_method when left out."),
2866− "commit_title": {
2867− "type": "string",
2868− "description": "For merge and squash: the commit message's first line. The repository's default when left out.",
2869− },
2870− "commit_message": {
2871− "type": "string",
2872− "description": "For merge and squash: the rest of the commit message. The repository's default when left out.",
2873− },
2874− "sha": {
2875− "type": "string",
2876− "description": "The head commit you reviewed: refused (409) if the pull request's head has moved since.",
2877− },
2878− "delete_branch": {
2879− "type": "boolean",
2880− "description": "Delete its branch once merged. The repository's delete_branch_on_merge when left out.",
2881− },
2882− })),
2883− &["repo", "number"],
2884− ),
2885− Op::UpdatePullRequestBranch => object(
2886− numbered(json!({
2887− "expected_head_sha": {
2888− "type": "string",
2889− "description": "The head commit you saw: refused (409) if the pull request's head has moved since.",
2890− },
2891− "update_method": {
2892− "type": "string",
2893− "enum": ["merge", "rebase"],
2894− "description": "merge (the default): a merge commit on its branch takes in the base's new commits. rebase: its commits are made again on the base's head, rewriting its branch.",
2895− },
2896− })),
2897− &["repo", "number"],
2898− ),
2899− Op::EnablePullRequestAutoMerge => object(
2900− numbered(json!({
2901− "merge_method": merge_method_schema("How it will merge: merge, squash, rebase or fast_forward. The repository's default_merge_method when left out."),
2902− "commit_title": {
2903− "type": "string",
2904− "description": "For merge and squash: the commit message's first line. The repository's default when left out.",
2905− },
2906− "commit_message": {
2907− "type": "string",
2908− "description": "For merge and squash: the rest of the commit message. The repository's default when left out.",
29092604 },
29102605 })),
29112606 &["repo", "number"],
29122607 ),
2913− Op::GetPullRequestMergeOptions
2914− | Op::DisablePullRequestAutoMerge
2915− | Op::DeletePullRequestHeadBranch
2916− | Op::RestorePullRequestHeadBranch => {
2917− just_numbered()
2918− }
2919− Op::ListRepoCommitComments => object(
2920− json!({
2921− "repo": repo_schema(),
2922− "page": { "type": "integer", "minimum": 1, "description": "From 1; 30 comments a page." },
2923− }),
2924− &["repo"],
2925− ),
2926− Op::ListCommitComments => object(
2927− json!({ "repo": repo_schema(), "sha": commit_sha_schema() }),
2928− &["repo", "sha"],
2929− ),
2930− Op::CreateCommitComment => object(
2931− json!({
2932− "repo": repo_schema(),
2933− "sha": commit_sha_schema(),
2934− "body": { "type": "string", "description": "Markdown." },
2935− "path": {
2936− "type": "string",
2937− "description": "A file the commit changed, from the repository's root, to comment on one of its lines.",
2938− },
2939− "line": {
2940− "type": "integer",
2941− "minimum": 1,
2942− "description": "With path: the line, as the commit left the file, counted from 1.",
2943− },
2944− }),
2945− &["repo", "sha", "body"],
2946− ),
2947− Op::UpdateCommitComment => object(
2948− json!({
2949− "repo": repo_schema(),
2950− "comment_id": commit_comment_id_schema(),
2951− "body": { "type": "string", "description": "The new text, in Markdown." },
2952− }),
2953− &["repo", "comment_id", "body"],
2954− ),
2955− Op::DeleteCommitComment => object(
2956− json!({ "repo": repo_schema(), "comment_id": commit_comment_id_schema() }),
2957− &["repo", "comment_id"],
2958− ),
29592608 Op::ListEvents => object(
29602609 json!({
29612610 "repo": repo_schema(),
37313380 Op::ListRepos
37323381 | Op::Search
37333382 | Op::GetRepo
3734− | Op::ListForks
37353383 | Op::ListIssues
37363384 | Op::GetIssue
37373385 | Op::ListLabels
37443392 | Op::ListDecisions
37453393 | Op::Why
37463394 | Op::GetPullRequestChanges
3747− | Op::GetPullRequestMergeOptions
3748− | Op::ListRepoCommitComments
3749− | Op::ListCommitComments
37503395 | Op::ListEvents
37513396 | Op::GetRepoSettings
37523397 | Op::ListCheckNames
37673412 | ProtectionOp::GetWorkflowPermissions
37683413 | ProtectionOp::GetForkPrApproval
37693414 | ProtectionOp::GetActionsAccess
3770− | ProtectionOp::GetActionsPermissions
37713415 )
37723416 )
37733417 }
40623706 keep_issue_open: input["keep_issue_open"].as_bool() == Some(true),
40633707 ignore_checks: input["ignore_checks"].as_bool() == Some(true),
40643708 bypass_rules: input["bypass_rules"].as_bool() == Some(true),
4065− merge_method: None,
4066− commit_title: None,
4067− commit_message: None,
4068− expected_head: None,
4069− delete_branch: None,
4070− update_method: None,
40713709 };
40723710 let Services {
40733711 identity,
44574095 "to": text(input, "to").to_lowercase(),
44584096 "surface": services.audit.surface,
44594097 }),
4460− )
4461− .await
4462− }
4463− Op::ForkRepo => {
4464− let owner = actor();
4465− // Your personal workspace (your username's), or the only
4466− // one you belong to, when none is named.
4467− let namespace = optional_text(input, "workspace").map(|slug| slug.to_lowercase()).unwrap_or_else(|| {
4468− if owner.workspaces.iter().any(|w| w.slug == owner.username) {
4469− owner.username.clone()
4470− } else {
4471− match owner.workspaces.as_slice() {
4472− [only] => only.slug.clone(),
4473− _ => String::new(),
4474− }
4475− }
4476− });
4477− pass(
4478− repos,
4479− "fork",
4480− &ForkRepoArgs {
4481− actor: owner,
4482− path: repo,
4483− namespace,
4484− name: optional_text(input, "name"),
4485− description: input["description"].as_str().map(str::to_owned),
4486− default_branch_only: input["default_branch_only"].as_bool() != Some(false),
4487− surface: Some(services.audit.surface),
4488− },
44894098 )
44904099 .await
44914100 }
4492− Op::ListForks => {
4493− pass(
4494− repos,
4495− "forks",
4496− &ForksArgs {
4497− viewer: viewer.clone(),
4498− path: repo,
4499− limit: integer(input, "limit"),
4500− },
4501− )
4502− .await
4503− }
4504− Op::SyncFork => {
4505− pass(
4506− repos,
4507− "sync_fork",
4508− &SyncForkArgs {
4509− actor: actor(),
4510− path: repo,
4511− branch: optional_text(input, "branch"),
4512− surface: Some(services.audit.surface),
4513− },
4514− )
4515− .await
4516− }
4517− Op::DetachFork => {
4518− pass(
4519− repos,
4520− "detach_fork",
4521− &DetachForkArgs {
4522− actor: actor(),
4523− path: repo,
4524− surface: Some(services.audit.surface),
4525− },
4526− )
4527− .await
4528− }
45294101 Op::ListRepos => {
45304102 let found: Vec<Repo> = g1t_kit::call(
45314103 repos,
45524124 .await
45534125 }
45544126 Op::UpdateRepo => {
4555− let max_ref_updates = integer(input, "max_ref_updates");
4556− if input.get("max_ref_updates").is_some_and(|given| !given.is_null()) && max_ref_updates.is_none() {
4557− return failed(FailureCode::Invalid, "max_ref_updates must be a whole number, 0 for no limit.");
4558− }
45594127 let updated = pass(
45604128 repos,
45614129 "update",
45674135 "protected": input["protected"].as_bool(),
45684136 "topics": strings(input, "topics"),
45694137 "website": input["website"].as_str(),
4570− "allowForking": input["allow_forking"].as_bool(),
4571− "maxRefUpdates": max_ref_updates,
45724138 "surface": services.audit.surface,
45734139 }),
45744140 )
47624328 Outcome::Fail(failure) => return Ok(Outcome::Fail(failure)),
47634329 };
47644330 let flag = |key: &str, now: bool| input[key].as_bool().unwrap_or(now);
4765− let default_merge_method = match merge_method(input, "default_merge_method") {
4766− Ok(method) => method.unwrap_or(current.default_merge_method),
4767− Err(message) => return failed(FailureCode::Invalid, &message),
4768− };
4769− let merge_commit_message = match commit_message_default(input, "merge_commit_message") {
4770− Ok(Some(CommitMessageDefault::PullTitleAndCommits)) => {
4771− return failed(FailureCode::Invalid, "pull_title_and_commits is for squash commits: use it in squash_commit_message.");
4772− }
4773− Ok(given) => given.unwrap_or(current.merge_commit_message),
4774− Err(message) => return failed(FailureCode::Invalid, &message),
4775− };
4776− let squash_commit_message = match commit_message_default(input, "squash_commit_message") {
4777− Ok(given) => given.unwrap_or(current.squash_commit_message),
4778− Err(message) => return failed(FailureCode::Invalid, &message),
4779− };
4780− // A template given empty clears it; one left out stays.
4781− let template = |key: &str, now: &Option<String>| match input.get(key) {
4782− None => now.clone(),
4783− Some(given) => given.as_str().map(str::to_owned).filter(|text| !text.trim().is_empty()),
4784− };
4785− let has_issues = match input.get("has_issues") {
4786− None => current.has_issues,
4787− Some(Value::Null) => None,
4788− Some(given) => match given.as_bool() {
4789− Some(on) => Some(on),
4790− None => return failed(FailureCode::Invalid, "has_issues must be true, false or null."),
4791− },
4792− };
47934331 let settings = RepoSettings {
4794− allow_merge_commit: flag("allow_merge_commit", current.allow_merge_commit),
4795− allow_squash_merge: flag("allow_squash_merge", current.allow_squash_merge),
4796− allow_rebase_merge: flag("allow_rebase_merge", current.allow_rebase_merge),
4797− allow_fast_forward: flag("allow_fast_forward", current.allow_fast_forward),
4798− default_merge_method,
4799− merge_commit_message,
4800− squash_commit_message,
4801− merge_commit_template: template("merge_commit_template", &current.merge_commit_template),
4802− squash_commit_template: template("squash_commit_template", &current.squash_commit_template),
4803− suggest_updating_branches: flag("suggest_updating_branches", current.suggest_updating_branches),
4804− allow_auto_merge: flag("allow_auto_merge", current.allow_auto_merge),
4805− delete_branch_on_merge: flag("delete_branch_on_merge", current.delete_branch_on_merge),
4806− require_web_commit_sign_off: flag("require_web_commit_sign_off", current.require_web_commit_sign_off),
4807− allow_commit_comments: flag("allow_commit_comments", current.allow_commit_comments),
4808− auto_close_issues: flag("auto_close_issues", current.auto_close_issues),
4809− has_issues,
48104332 auto_merge: flag("auto_merge", current.auto_merge),
48114333 required_checks: strings(input, "required_checks").unwrap_or(current.required_checks.clone()),
48124334 require_up_to_date: flag("require_up_to_date", current.require_up_to_date),
51214643 Op::GetPullRequest => pass(work, "get_pull", &view()).await,
51224644 Op::CreatePullRequest => {
51234645 let user = actor();
5124− // A fork named but not as `owner/name` is refused, never
5125− // read as the repository's own branch of that name.
5126− let head_repo = match optional_text(input, "head_repo") {
5127− Some(_) => match repo_path(&json!({ "repo": input["head_repo"] })) {
5128− Some(path) => Some(path),
5129− None => return failed(FailureCode::Invalid, "Give head_repo as owner/name."),
5130− },
5131− None => None,
5132− };
51334646 let opened: Outcome<Pull> = call(
51344647 work,
51354648 "open_pull",
51404653 title: text(input, "title"),
51414654 body: text(input, "body"),
51424655 branch: optional_text(input, "branch"),
5143− head_repo,
51444656 // Unnamed, the change is its author's, unless an agent's token opened it.
51454657 agent: optional_text(input, "agent")
51464658 .unwrap_or_else(|| if g1t_contracts::rules::is_agent(&user) { "agent".into() } else { user.username.clone() }),
51554667 Outcome::Fail(failure) => return Ok(Outcome::Fail(failure)),
51564668 };
51574669 // Where to push. A pull request from a branch has no fork:
5158− // push to that branch of the repository, or of the fork
5159− // it was opened from.
5160− let source = pull.fork.as_ref().or(pull.head_repo.as_ref()).unwrap_or(&repo);
4670+ // push to that branch of the repository.
4671+ let source = pull.fork.as_ref().unwrap_or(&repo);
51614672 let remote = services.addresses.git_remote(&source.namespace, &source.name);
51624673 ok(&json!({
51634674 "pull": pull,
52394750 let method = if self == Op::EditComment { "edit_comment" } else { "delete_comment" };
52404751 pass(work, method, &asked).await
52414752 }
5242− Op::MergePullRequest => {
5243− let method = match merge_method(input, "merge_method") {
5244− Ok(method) => method,
5245− Err(message) => return failed(FailureCode::Invalid, &message),
5246− };
5247− let asked = PullActionArgs {
5248− merge_method: method,
5249− commit_title: optional_text(input, "commit_title"),
5250− commit_message: input["commit_message"].as_str().map(str::to_owned),
5251− expected_head: optional_text(input, "sha"),
5252− delete_branch: input["delete_branch"].as_bool(),
5253− ..pull_action()
5254− };
5255− pass(work, "merge_pull", &asked).await
5256− }
5257− Op::GetPullRequestMergeOptions => pass(work, "merge_choices", &view()).await,
5258− Op::UpdatePullRequestBranch => {
5259− let update_method = match input["update_method"].as_str().map(str::trim).filter(|given| !given.is_empty()) {
5260− None => None,
5261− Some(given) if given.eq_ignore_ascii_case("merge") => Some(UpdateMethod::Merge),
5262− Some(given) if given.eq_ignore_ascii_case("rebase") => Some(UpdateMethod::Rebase),
5263− Some(given) => return failed(FailureCode::Invalid, &format!("update_method must be merge or rebase, not {given}.")),
5264− };
5265− let asked = PullActionArgs {
5266− expected_head: optional_text(input, "expected_head_sha"),
5267− update_method,
5268− ..pull_action()
5269− };
5270− pass(work, "catch_up_pull", &asked).await
5271− }
5272− Op::EnablePullRequestAutoMerge | Op::DisablePullRequestAutoMerge => {
5273− let enabled = self == Op::EnablePullRequestAutoMerge;
5274− let method = match merge_method(input, "merge_method") {
5275− Ok(method) => method.filter(|_| enabled),
5276− Err(message) if enabled => return failed(FailureCode::Invalid, &message),
5277− Err(_) => None,
5278− };
5279− pass(
5280− work,
5281− "set_auto_merge",
5282− &SetAutoMergeArgs {
5283− actor: actor(),
5284− repo,
5285− number,
5286− enabled,
5287− merge_method: method,
5288− commit_title: optional_text(input, "commit_title").filter(|_| enabled),
5289− commit_message: input["commit_message"].as_str().map(str::to_owned).filter(|_| enabled),
5290− },
5291− )
5292− .await
5293− }
5294− Op::DeletePullRequestHeadBranch => pass(work, "delete_head_branch", &pull_action()).await,
5295− Op::RestorePullRequestHeadBranch => pass(work, "restore_head_branch", &pull_action()).await,
5296− Op::ListRepoCommitComments | Op::ListCommitComments => {
5297− let commit = if self == Op::ListCommitComments {
5298− match optional_text(input, "sha") {
5299− Some(sha) => Some(sha),
5300− None => return failed(FailureCode::Invalid, "Give sha: the commit's hash."),
5301− }
5302− } else {
5303− None
5304− };
5305− pass(
5306− work,
5307− "commit_comments",
5308− &CommitCommentsArgs {
5309− viewer: viewer.clone(),
5310− repo,
5311− commit,
5312− page: integer(input, "page").filter(|page| *page > 0),
5313− },
5314− )
5315− .await
5316− }
5317− Op::CreateCommitComment => {
5318− let body = text(input, "body");
5319− if body.trim().is_empty() {
5320− return failed(FailureCode::Invalid, "Give body: the comment, in Markdown.");
5321− }
5322− let Some(commit) = optional_text(input, "sha") else {
5323− return failed(FailureCode::Invalid, "Give sha: the commit's hash.");
5324− };
5325− let path = optional_text(input, "path");
5326− let line = integer(input, "line").filter(|line| *line > 0);
5327− if input.get("line").is_some_and(|given| !given.is_null()) && line.is_none() {
5328− return failed(FailureCode::Invalid, "line is counted from 1.");
5329− }
5330− if line.is_some() && path.is_none() {
5331− return failed(FailureCode::Invalid, "Give path with line: the file the line is in.");
5332− }
5333− pass(
5334− work,
5335− "add_commit_comment",
5336− &AddCommitCommentArgs { actor: actor(), repo, commit, body, path, line },
5337− )
5338− .await
5339− }
5340− Op::UpdateCommitComment | Op::DeleteCommitComment => {
5341− let editing = self == Op::UpdateCommitComment;
5342− let body = text(input, "body");
5343− if editing && body.trim().is_empty() {
5344− return failed(FailureCode::Invalid, "Give body: the new text, in Markdown.");
5345− }
5346− let asked = CommitCommentArgs { actor: actor(), repo, id: text(input, "comment_id"), body };
5347− let method = if editing { "edit_commit_comment" } else { "delete_commit_comment" };
5348− pass(work, method, &asked).await
5349− }
4753+ Op::MergePullRequest => pass(work, "merge_pull", &pull_action()).await,
53504754 Op::GetPullRequestChanges => {
53514755 let found: Outcome<PullDetail> = call(work, "get_pull", &view()).await?;
53524756 match found {
+2−40
2626 SetForkPrApproval,
2727 GetActionsAccess,
2828 SetActionsAccess,
29− GetActionsPermissions,
30− SetActionsPermissions,
3129 CreateRepositoryDispatch,
3230 GetWorkspaceWorkflowPermissions,
3331 SetWorkspaceWorkflowPermissions,
4139 /// Every one: `Op::ALL` lists each as `Op::Protection(…)`, which a test
4240 /// checks against this.
4341 #[cfg(test)]
44− pub const ALL: [ProtectionOp; 20] = [
42+ pub const ALL: [ProtectionOp; 18] = [
4543 ProtectionOp::UpdateEnvironment,
4644 ProtectionOp::DeleteEnvironment,
4745 ProtectionOp::GetPendingDeployments,
5351 ProtectionOp::SetForkPrApproval,
5452 ProtectionOp::GetActionsAccess,
5553 ProtectionOp::SetActionsAccess,
56− ProtectionOp::GetActionsPermissions,
57− ProtectionOp::SetActionsPermissions,
5854 ProtectionOp::CreateRepositoryDispatch,
5955 ProtectionOp::GetWorkspaceWorkflowPermissions,
6056 ProtectionOp::SetWorkspaceWorkflowPermissions,
7773 ProtectionOp::SetForkPrApproval => "set_fork_pr_approval",
7874 ProtectionOp::GetActionsAccess => "get_actions_access",
7975 ProtectionOp::SetActionsAccess => "set_actions_access",
80− ProtectionOp::GetActionsPermissions => "get_actions_permissions",
81− ProtectionOp::SetActionsPermissions => "set_actions_permissions",
8276 ProtectionOp::CreateRepositoryDispatch => "create_repository_dispatch",
8377 ProtectionOp::GetWorkspaceWorkflowPermissions => "get_workspace_workflow_permissions",
8478 ProtectionOp::SetWorkspaceWorkflowPermissions => "set_workspace_workflow_permissions",
119113 ProtectionOp::SetForkPrApproval => "Set the approval policy for outside pull requests",
120114 ProtectionOp::GetActionsAccess => "Get who may use a repository's actions and workflows",
121115 ProtectionOp::SetActionsAccess => "Set who may use a repository's actions and workflows",
122− ProtectionOp::GetActionsPermissions => "Get whether a repository's workflows run",
123− ProtectionOp::SetActionsPermissions => "Turn a repository's workflows on or off",
124116 ProtectionOp::CreateRepositoryDispatch => "Create a repository dispatch event",
125117 ProtectionOp::GetWorkspaceWorkflowPermissions => "Get a workspace's default workflow permissions",
126118 ProtectionOp::SetWorkspaceWorkflowPermissions => "Set a workspace's default workflow permissions",
144136 ProtectionOp::SetForkPrApproval => "Set approval_policy: first_time_contributors, outside_contributors or all_external_contributors. Needs the Admin role.",
145137 ProtectionOp::GetActionsAccess => "Which other repositories' workflows may use this private repository's actions (uses: owner/repo@ref) and reusable workflows (jobs.<id>.uses: owner/repo/.g1t/workflows/build.yml@ref): access_level is none (the default: only this repository) or organization (private repositories in the same workspace). A public repository's actions and workflows are anyone's, whatever this says, and a public repository's workflows never use a private one's. Needs the Read role.",
146138 ProtectionOp::SetActionsAccess => "Set access_level: none, or organization to let the workspace's other private repositories use this repository's actions and reusable workflows (user is read as organization). Needs the Admin role.",
147− ProtectionOp::GetActionsPermissions => "Whether a repository's workflows run at all: enabled is on for a repository and off for a fork until someone chooses (enabled_chosen says whether anyone has), so a fork never runs the workflows it copied until they are turned on. While it is off, no push, pull request, schedule, dispatch, repository_dispatch, merge queue or re-run starts a run; its workflows stay listed. allowed_actions is always all. Needs the Read role.",
148− ProtectionOp::SetActionsPermissions => "Turn a repository's workflows on or off (enabled). Off, nothing starts a run, and a dispatch or re-run is refused with \"Actions is turned off for owner/name\"; runs already going finish. Turning it on runs nothing by itself: the next event does. Needs the Admin role; a workflow job's own token cannot.",
149139 ProtectionOp::GetWorkspaceWorkflowPermissions => "A workspace's policy for its repositories' job tokens: default_workflow_permissions (read, the default, or write) is what a repository made from now on gets until it chooses; max_workflow_permissions (write, the default, or read) is the most any repository's default may be, so read holds every repository to read-only; can_approve_pull_request_reviews (off by default) lets its repositories allow jobs to open and approve pull requests. Members only.",
150140 ProtectionOp::SetWorkspaceWorkflowPermissions => "Change a workspace's default_workflow_permissions, max_workflow_permissions and can_approve_pull_request_reviews; fields left out stay as they are. A maximum of read makes the default read too. Owners only.",
151141 ProtectionOp::ListWorkspaceManagedWorkflows => "The workflows a workspace's owners added to its repositories, g1t's required workflows: each runs in every repository it targets as that repository's own workflow (its token, its secrets, its checks), under the path managed/<name>.yml, from a copy of its source file taken when it was saved. Each has name, path, workflow_name (its `name:`), source (owner/repo/path@ref), source_sha (the commit it was copied at), source_private, mode, repositories, visibility, content (the copy that runs) and when and by whom it was last saved. Owners only.",
164154 | ProtectionOp::GetWorkflowPermissions
165155 | ProtectionOp::GetForkPrApproval
166156 | ProtectionOp::GetActionsAccess
167− | ProtectionOp::GetActionsPermissions
168157 | ProtectionOp::GetWorkspaceWorkflowPermissions
169158 | ProtectionOp::ListWorkspaceManagedWorkflows
170159 )
228217 }),
229218 &["repo", "id", "state"],
230219 ),
231− ProtectionOp::GetWorkflowPermissions
232− | ProtectionOp::GetForkPrApproval
233− | ProtectionOp::GetActionsAccess
234− | ProtectionOp::GetActionsPermissions => (json!({ "repo": repo }), &["repo"]),
235− ProtectionOp::SetActionsPermissions => (
236− json!({
237− "repo": repo,
238− "enabled": { "type": "boolean", "description": "Whether its workflows run." },
239− }),
240− &["repo", "enabled"],
241− ),
220+ ProtectionOp::GetWorkflowPermissions | ProtectionOp::GetForkPrApproval | ProtectionOp::GetActionsAccess => (json!({ "repo": repo }), &["repo"]),
242221 ProtectionOp::SetActionsAccess => (
243222 json!({
244223 "repo": repo,
734713 .await?
735714 };
736715 map(settings, |s| json!({ "access_level": s["accessLevel"] }))
737− }
738− ProtectionOp::GetActionsPermissions | ProtectionOp::SetActionsPermissions => {
739− let settings: Outcome<Value> = if op == ProtectionOp::GetActionsPermissions {
740− g1t_kit::call(actions, "actions_settings", &json!({ "viewer": viewer, "repo": repo })).await?
741− } else {
742− let Some(enabled) = flag(input, "enabled") else {
743− return Ok(Outcome::fail(FailureCode::Invalid, "enabled is true or false."));
744− };
745− g1t_kit::call(actions, "set_actions_settings", &json!({ "actor": actor(), "repo": repo, "enabled": enabled })).await?
746− };
747− map(settings, |s| {
748− json!({
749− "enabled": s.get("enabled").cloned().unwrap_or(Value::Bool(true)),
750− "enabled_chosen": s.get("enabledChosen").cloned().unwrap_or(Value::Bool(false)),
751− "allowed_actions": "all",
752− })
753− })
754716 }
755717 ProtectionOp::CreateRepositoryDispatch => {
756718 let started: Outcome<u32> = g1t_kit::call(
+5−597
707707 "website": "https://hello.g1t.page",
708708 "archived_at": null
709709 },
710− "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/)."
710+ "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` 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. See [Managing a repository](/guides/managing-repositories/) and [Access and roles](/guides/access-and-roles/)."
711711 },
712712 "transfer_repo": {
713713 "request": {
728728 "archived_at": null
729729 },
730730 "notes": "The repository at its new address. Refused with `409` when the destination already has a repository of that name, `403` unless you own both workspaces, and `402` when a free destination has no room for a private repository. The old address redirects. See [Transferring a repository](/guides/transferring-repositories/)."
731− },
732− "fork_repo": {
733− "request": {
734− "workspace": "ada",
735− "default_branch_only": true
736− },
737− "response": {
738− "id": "rep_01m4b7k2v9c3tq8x5n6d0fr1hz",
739− "namespace": "ada",
740− "name": "hello",
741− "description": "A tiny service that says hello.",
742− "is_private": false,
743− "owner_id": "usr_01kq3r8w2m6vd5e9t0hy7jx4cb",
744− "default_branch": "main",
745− "fork_of": null,
746− "parent_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
747− "parent": {
748− "namespace": "flagon-io",
749− "name": "hello"
750− },
751− "allow_forking": false,
752− "protected": false,
753− "created_at": "2026-10-14T09:30:12.418Z",
754− "website": null,
755− "archived_at": null
756− },
757− "notes": "The new fork, with `parent` naming the repository it came from. Refused with `403` when the repository is private and its admins have not allowed forking, or when you cannot create repositories in the workspace; `409` when the workspace already has a repository of that name (give another `name`); `402` when a free workspace's private storage has no room for a private fork. Its code and description are copied; nothing else is. See [Forking a repository](/guides/forking-repositories/) and [Forks](/concepts/forks/)."
758− },
759− "list_forks": {
760− "query": {
761− "limit": "30"
762− },
763− "response": [
764− {
765− "id": "rep_01m4b7k2v9c3tq8x5n6d0fr1hz",
766− "namespace": "ada",
767− "name": "hello",
768− "description": "A tiny service that says hello.",
769− "is_private": false,
770− "owner_id": "usr_01kq3r8w2m6vd5e9t0hy7jx4cb",
771− "default_branch": "main",
772− "fork_of": null,
773− "parent_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
774− "parent": {
775− "namespace": "flagon-io",
776− "name": "hello"
777− },
778− "allow_forking": false,
779− "protected": false,
780− "created_at": "2026-10-14T09:30:12.418Z",
781− "website": null,
782− "archived_at": null
783− }
784− ],
785− "notes": "Only the forks you can read, newest first: a private repository's forks are listed for people who can read them. Forks of a fork are listed on that fork. See [Forks](/concepts/forks/)."
786731 },
787− "sync_fork": {
788− "request": {
789− "branch": "main"
790− },
791− "response": {
792− "status": "fast_forwarded",
793− "branch": "main",
794− "head": "9c4e1f0b7a2d3e5f6a8b9c0d1e2f3a4b5c6d7e8f",
795− "behind": 3,
796− "ahead": 0,
797− "conflicts": []
798− },
799− "notes": "`status` is `up_to_date`, `fast_forwarded`, `merged` (a merge commit joins the fork's own commits and the parent's) or `conflicted`: both sides changed the files in `conflicts`, and nothing was changed. Merge the parent's branch in a clone and push. Refused with `422` when the repository is not a fork, `403` without the Write role on it, and `404` when its parent is gone or you can no longer read it. See [Sync a fork](/guides/forking-repositories/#sync-a-fork)."
800− },
801− "detach_fork": {
802− "response": {
803− "id": "rep_01m4b7k2v9c3tq8x5n6d0fr1hz",
804− "namespace": "ada",
805− "name": "hello",
806− "description": "A tiny service that says hello.",
807− "is_private": false,
808− "owner_id": "usr_01kq3r8w2m6vd5e9t0hy7jx4cb",
809− "default_branch": "main",
810− "fork_of": null,
811− "parent_id": null,
812− "parent": null,
813− "allow_forking": false,
814− "protected": false,
815− "created_at": "2026-10-14T09:30:12.418Z",
816− "website": null,
817− "archived_at": null
818− },
819− "notes": "The repository, now with no parent. Needs the Admin role (`403` otherwise); `422` when it is not a fork. It cannot be attached again. See [Detach a fork](/guides/forking-repositories/#detach-a-fork)."
820− },
821732 "rename_repo": {
822733 "request": {
823734 "name": "greeter"
1035946 "allow_ignoring_checks": true,
1036947 "merge_queue": false,
1037948 "require_code_owner_review": false,
1038− "has_issues": null,
1039− "issues_enabled": true,
1040− "allow_merge_commit": true,
1041− "allow_squash_merge": true,
1042− "allow_rebase_merge": true,
1043− "allow_fast_forward": false,
1044− "default_merge_method": "merge",
1045− "merge_commit_message": "default",
1046− "squash_commit_message": "default",
1047− "merge_commit_template": null,
1048− "squash_commit_template": null,
1049− "suggest_updating_branches": true,
1050− "allow_auto_merge": true,
1051− "delete_branch_on_merge": false,
1052− "require_web_commit_sign_off": false,
1053− "allow_commit_comments": true,
1054− "auto_close_issues": true,
1055949 "updated_by": null,
1056950 "updated_at": null
1057951 }
1065959 "required_approvals": 1,
1066960 "count_agent_approvals": false,
1067961 "merge_queue": true,
1068− "require_code_owner_review": true,
1069− "allow_merge_commit": false,
1070− "default_merge_method": "squash",
1071− "squash_commit_message": "pull_title_and_description",
1072− "delete_branch_on_merge": true
962+ "require_code_owner_review": true
1073963 },
1074964 "response": {
1075965 "auto_merge": false,
1083973 "allow_ignoring_checks": true,
1084974 "merge_queue": true,
1085975 "require_code_owner_review": true,
1086− "has_issues": null,
1087− "issues_enabled": true,
1088− "allow_merge_commit": false,
1089− "allow_squash_merge": true,
1090− "allow_rebase_merge": true,
1091− "allow_fast_forward": false,
1092− "default_merge_method": "squash",
1093− "merge_commit_message": "default",
1094− "squash_commit_message": "pull_title_and_description",
1095− "merge_commit_template": null,
1096− "squash_commit_template": null,
1097− "suggest_updating_branches": true,
1098− "allow_auto_merge": true,
1099− "delete_branch_on_merge": true,
1100− "require_web_commit_sign_off": false,
1101− "allow_commit_comments": true,
1102− "auto_close_issues": true,
1103976 "updated_by": "syntaqx",
1104977 "updated_at": "2026-10-04T16:20:37.508Z"
1105978 },
1106− "notes": "`required_checks` replaces the whole list: at most 20 names, each a workflow's name or another status's context, as [`list_check_names`](/reference/api/repositories/list-check-names/) gives them. A pull request merges only once each passes on its head; one nothing has reported holds it too. With the merge queue on, each must also pass on the queued state, so the workflows behind them need `merge_group` in their `on:`. `required_approvals` is at most 6. See [what a repository can ask for](/guides/working-with-g1t/#what-a-repository-can-ask-for). With `require_code_owner_review`, a pull request into the default branch merges only once the code owners of every file it changes have approved it, as many as each section of its CODEOWNERS file asks: see [Code owners](/guides/codeowners/). At least one of `allow_merge_commit`, `allow_squash_merge`, `allow_rebase_merge` and `allow_fast_forward` stays on, and `default_merge_method` must be one of them (`422` otherwise). `merge_commit_template` and `squash_commit_template` are used with `custom`: see [Commit messages](/guides/pull-requests/#commit-messages) for their placeholders. `has_issues` `null` goes back to the default: on for a repository, off for a fork. See [Repository settings](/guides/managing-repositories/#settings)."
979+ "notes": "`required_checks` replaces the whole list: at most 20 names, each a workflow's name or another status's context, as [`list_check_names`](/reference/api/repositories/list-check-names/) gives them. A pull request merges only once each passes on its head; one nothing has reported holds it too. With the merge queue on, each must also pass on the queued state, so the workflows behind them need `merge_group` in their `on:`. `required_approvals` is at most 6. See [what a repository can ask for](/guides/working-with-g1t/#what-a-repository-can-ask-for). With `require_code_owner_review`, a pull request into the default branch merges only once the code owners of every file it changes have approved it, as many as each section of its CODEOWNERS file asks: see [Code owners](/guides/codeowners/)."
1107980 },
1108981 "list_check_names": {
1109982 "response": [
21772050 },
21782051 "notes": "Takes them off who is asked; anyone not asked is ignored. Reviews they already gave stay, as do the people a team's review assignment picked: remove them by username."
21792052 },
2180− "get_pull_request_merge_options": {
2181− "response": {
2182− "methods": [
2183− "merge",
2184− "squash",
2185− "rebase"
2186− ],
2187− "default_method": "squash",
2188− "options": [
2189− {
2190− "method": "merge",
2191− "commit_title": "Merge pull request #14 from flagon-io/greet-caller",
2192− "commit_message": "Greeting should name the caller",
2193− "unavailable": null
2194− },
2195− {
2196− "method": "squash",
2197− "commit_title": "Greeting should name the caller (#14)",
2198− "commit_message": "* Read the name from the first argument\n* Fall back to \"world\"",
2199− "unavailable": null
2200− },
2201− {
2202− "method": "rebase",
2203− "commit_title": null,
2204− "commit_message": null,
2205− "unavailable": null
2206− }
2207− ],
2208− "behind": false,
2209− "can_fast_forward": false,
2210− "suggest_update": false,
2211− "require_up_to_date": false,
2212− "merge_queue": false,
2213− "auto_merge_allowed": true,
2214− "delete_branch_default": true,
2215− "can_delete_branch": true,
2216− "sign_off": false
2217− },
2218− "notes": "`methods` are the repository's allowed methods, narrowed by the rules for the branch it merges into: required linear history leaves out `merge`. `fast_forward` lists `unavailable` until the branch contains its base's head. `merge` and `squash` carry the commit message a merge would use if you wrote none. See [Merging a pull request](/guides/pull-requests/#merging-a-pull-request)."
2219− },
22202053 "merge_pull_request": {
22212054 "request": {
2222− "merge_method": "squash",
2223− "commit_title": "Greeting names the caller (#14)",
2224− "sha": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2225− "delete_branch": true
2055+ "keep_issue_open": false
22262056 },
22272057 "response": {
22282058 "id": "pr_01m43smh3vexsr5pmp60qwv0vs",
22442074 "merge_base": "3a7e9c1b5d2f4a6c8e0b2d4f6a8c0e2b4d6f8a1c",
22452075 "merged_by": "syntaqx",
22462076 "merged_at": "2026-10-01T18:52:17.093Z",
2247− "merge_method": "squash",
2248− "merge_commit": "c41d7e2a9b0f3e5d7c9a1b3d5f7e9c0a2b4d6f81",
2249− "closes": [
2250− 12
2251− ],
22522077 "superseded_by": null,
22532078 "check_status": "passed",
22542079 "files": [
22772102 "created_at": "2026-10-01T18:20:02.117Z",
22782103 "updated_at": "2026-10-01T18:52:17.093Z"
22792104 },
2280− "notes": "A draft, or one whose checks have not passed, answers `409`. A pull request still `open` in the response has not landed yet: `landing` is true on it while it is brought up to date, and [get the merge queue](/reference/api/pull-requests/get-merge-queue/) shows it waiting in the [merge queue](/guides/merge-queue/). Merging records the pull request in the issue's `resolved_by`, closes the issues in `closes` (into the default branch, where `auto_close_issues` is on) and sets `superseded_by` on the pull requests it closes. A `merge_method` the repository or a rule for the base does not allow answers `422`, and a head that moved since `sha`, `409`. `merge_commit` is the commit the base is at afterwards: the merge or squash commit, the last rebased one, or the head for a fast-forward. See [Merging a pull request](/guides/pull-requests/#merging-a-pull-request)."
2281− },
2282− "update_pull_request_branch": {
2283− "request": {
2284− "expected_head_sha": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2285− "update_method": "merge"
2286− },
2287− "response": {
2288− "outcome": "updated",
2289− "commit": "5b8d0f2a4c6e8a0c2e4a6c8e0a2c4e6a8c0e2a4c",
2290− "previous": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13"
2291− },
2292− "notes": "`outcome` is `updated` (its branch moved from `previous` to `commit`), `up_to_date` (it already holds its base's head; `commit` only) or `needs_agent` (nothing was pushed: `reason` is `overlap`, `conflicting` or `unsupported`, with `detail` and the `paths` concerned). `update_method` `rebase` rewrites its branch, so pull it again before pushing more. A head that moved since `expected_head_sha` answers `409`. See [Keeping a pull request up to date](/guides/pull-requests/#keeping-it-up-to-date)."
2293− },
2294− "enable_pull_request_auto_merge": {
2295− "request": {
2296− "merge_method": "squash",
2297− "commit_title": "Greeting names the caller (#14)"
2298− },
2299− "response": {
2300− "id": "pr_01m43smh3vexsr5pmp60qwv0vs",
2301− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2302− "number": 14,
2303− "issue": 12,
2304− "title": "Greeting should name the caller",
2305− "body": "Reads a name from the first argument. `hello ana` prints \"Hello, ana!\".",
2306− "agent": "claude-code",
2307− "runtime": "external",
2308− "status": "open",
2309− "fork": {
2310− "namespace": "pulls",
2311− "name": "pr_01m43smh3vexsr5pmp60qwv0vs"
2312− },
2313− "fork_repo_id": "rep_01m43smh5xd7aw2kq9tv0b4c8e",
2314− "branch": null,
2315− "head_commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2316− "merge_base": "3a7e9c1b5d2f4a6c8e0b2d4f6a8c0e2b4d6f8a1c",
2317− "merged_by": null,
2318− "merged_at": null,
2319− "superseded_by": null,
2320− "check_status": "running",
2321− "files": [
2322− {
2323− "path": "src/main.rs",
2324− "additions": 6,
2325− "deletions": 2
2326− }
2327− ],
2328− "assignees": [],
2329− "reviewers": [
2330− "ana"
2331− ],
2332− "labels": [],
2333− "milestone": null,
2334− "base": "main",
2335− "author": {
2336− "id": "usr_01kkntcg1eeb98j62xjm7eh09p",
2337− "username": "syntaqx",
2338− "display_username": "syntaqx",
2339− "kind": "user",
2340− "verified": false,
2341− "workspaces": []
2342− },
2343− "requested_by": null,
2344− "created_at": "2026-10-01T18:20:02.117Z",
2345− "updated_at": "2026-10-01T18:44:09.310Z",
2346− "auto_merge": {
2347− "method": "squash",
2348− "commit_title": "Greeting names the caller (#14)",
2349− "commit_message": null,
2350− "enabled_by": "syntaqx",
2351− "enabled_at": "2026-10-01T18:44:09.310Z"
2352− },
2353− "closes": [
2354− 12
2355− ]
2356− },
2357− "notes": "A repository with `allow_auto_merge` off answers `422`, as does a method it or a rule for the base does not allow. A pull request that may already merge merges at once: check `status`. `auto_merge` is cleared when it merges or closes, when it is turned off, and when someone other than `enabled_by` pushes to it. See [Auto-merge](/guides/pull-requests/#auto-merge)."
2358− },
2359− "disable_pull_request_auto_merge": {
2360− "response": {
2361− "id": "pr_01m43smh3vexsr5pmp60qwv0vs",
2362− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2363− "number": 14,
2364− "issue": 12,
2365− "title": "Greeting should name the caller",
2366− "body": "Reads a name from the first argument. `hello ana` prints \"Hello, ana!\".",
2367− "agent": "claude-code",
2368− "runtime": "external",
2369− "status": "open",
2370− "fork": {
2371− "namespace": "pulls",
2372− "name": "pr_01m43smh3vexsr5pmp60qwv0vs"
2373− },
2374− "fork_repo_id": "rep_01m43smh5xd7aw2kq9tv0b4c8e",
2375− "branch": null,
2376− "head_commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2377− "merge_base": "3a7e9c1b5d2f4a6c8e0b2d4f6a8c0e2b4d6f8a1c",
2378− "merged_by": null,
2379− "merged_at": null,
2380− "superseded_by": null,
2381− "check_status": "running",
2382− "files": [
2383− {
2384− "path": "src/main.rs",
2385− "additions": 6,
2386− "deletions": 2
2387− }
2388− ],
2389− "assignees": [],
2390− "reviewers": [
2391− "ana"
2392− ],
2393− "labels": [],
2394− "milestone": null,
2395− "base": "main",
2396− "author": {
2397− "id": "usr_01kkntcg1eeb98j62xjm7eh09p",
2398− "username": "syntaqx",
2399− "display_username": "syntaqx",
2400− "kind": "user",
2401− "verified": false,
2402− "workspaces": []
2403− },
2404− "requested_by": null,
2405− "created_at": "2026-10-01T18:20:02.117Z",
2406− "updated_at": "2026-10-01T18:44:09.310Z",
2407− "auto_merge": null,
2408− "closes": [
2409− 12
2410− ]
2411− }
2412− },
2413− "delete_pull_request_head_branch": {
2414− "response": {
2415− "id": "pr_01m43smh3vexsr5pmp60qwv0vs",
2416− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2417− "number": 14,
2418− "issue": 12,
2419− "title": "Greeting should name the caller",
2420− "body": "Reads a name from the first argument. `hello ana` prints \"Hello, ana!\".",
2421− "agent": "claude-code",
2422− "runtime": "external",
2423− "status": "merged",
2424− "fork": null,
2425− "fork_repo_id": null,
2426− "branch": "greet-caller",
2427− "head_commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2428− "merge_base": "3a7e9c1b5d2f4a6c8e0b2d4f6a8c0e2b4d6f8a1c",
2429− "merged_by": "syntaqx",
2430− "merged_at": "2026-10-01T18:52:17.093Z",
2431− "superseded_by": null,
2432− "check_status": "passed",
2433− "files": [
2434− {
2435− "path": "src/main.rs",
2436− "additions": 6,
2437− "deletions": 2
2438− }
2439− ],
2440− "assignees": [],
2441− "reviewers": [
2442− "ana"
2443− ],
2444− "labels": [],
2445− "milestone": null,
2446− "base": "main",
2447− "author": {
2448− "id": "usr_01kkntcg1eeb98j62xjm7eh09p",
2449− "username": "syntaqx",
2450− "display_username": "syntaqx",
2451− "kind": "user",
2452− "verified": false,
2453− "workspaces": []
2454− },
2455− "requested_by": null,
2456− "created_at": "2026-10-01T18:20:02.117Z",
2457− "updated_at": "2026-10-01T18:53:02.415Z",
2458− "merge_method": "squash",
2459− "merge_commit": "c41d7e2a9b0f3e5d7c9a1b3d5f7e9c0a2b4d6f81",
2460− "closes": [
2461− 12
2462− ],
2463− "head_branch_deleted": true
2464− },
2465− "notes": "An open pull request answers `409`: close or merge it first. `head_branch_deleted` is then `true`; [restore it](/reference/api/pull-requests/restore-pull-request-head-branch/) at `head_commit`."
2105+ "notes": "A draft, or one whose checks have not passed, answers `409`. A pull request still `open` in the response has not landed yet: `landing` is true on it while it is brought up to date, and [get the merge queue](/reference/api/pull-requests/get-merge-queue/) shows it waiting in the [merge queue](/guides/merge-queue/). Merging records the pull request in the issue's `resolved_by` and sets `superseded_by` on the pull requests it closes."
24662106 },
2467− "restore_pull_request_head_branch": {
2468− "response": {
2469− "id": "pr_01m43smh3vexsr5pmp60qwv0vs",
2470− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2471− "number": 14,
2472− "issue": 12,
2473− "title": "Greeting should name the caller",
2474− "body": "Reads a name from the first argument. `hello ana` prints \"Hello, ana!\".",
2475− "agent": "claude-code",
2476− "runtime": "external",
2477− "status": "merged",
2478− "fork": null,
2479− "fork_repo_id": null,
2480− "branch": "greet-caller",
2481− "head_commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2482− "merge_base": "3a7e9c1b5d2f4a6c8e0b2d4f6a8c0e2b4d6f8a1c",
2483− "merged_by": "syntaqx",
2484− "merged_at": "2026-10-01T18:52:17.093Z",
2485− "superseded_by": null,
2486− "check_status": "passed",
2487− "files": [
2488− {
2489− "path": "src/main.rs",
2490− "additions": 6,
2491− "deletions": 2
2492− }
2493− ],
2494− "assignees": [],
2495− "reviewers": [
2496− "ana"
2497− ],
2498− "labels": [],
2499− "milestone": null,
2500− "base": "main",
2501− "author": {
2502− "id": "usr_01kkntcg1eeb98j62xjm7eh09p",
2503− "username": "syntaqx",
2504− "display_username": "syntaqx",
2505− "kind": "user",
2506− "verified": false,
2507− "workspaces": []
2508− },
2509− "requested_by": null,
2510− "created_at": "2026-10-01T18:20:02.117Z",
2511− "updated_at": "2026-10-02T09:10:44.902Z",
2512− "merge_method": "squash",
2513− "merge_commit": "c41d7e2a9b0f3e5d7c9a1b3d5f7e9c0a2b4d6f81",
2514− "closes": [
2515− 12
2516− ],
2517− "head_branch_deleted": false
2518− },
2519− "notes": "The branch is made again at `head_commit`. A branch of that name that exists again answers `409`."
2520− },
2521− "list_repo_commit_comments": {
2522− "query": {
2523− "page": 1
2524− },
2525− "response": [
2526− {
2527− "id": "ccm_01m4a2s1b5c7e9g3k6m0p4s8v2",
2528− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2529− "commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2530− "path": null,
2531− "line": null,
2532− "author": "syntaqx",
2533− "body": "Released as v0.4.0.",
2534− "created_at": "2026-10-02T08:30:57.664Z",
2535− "updated_at": null
2536− },
2537− {
2538− "id": "ccm_01m4a2r7k3d9f1h5j8n2q6t0w4",
2539− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2540− "commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2541− "path": "src/main.rs",
2542− "line": 12,
2543− "author": "ana",
2544− "body": "Should an empty name fall back to \"world\"?",
2545− "created_at": "2026-10-01T19:02:11.208Z",
2546− "updated_at": null
2547− }
2548− ],
2549− "notes": "Newest first, 30 a page. A comment with `path` and `line` is on that line of the file as its `commit` left it; one without is on the whole commit."
2550− },
2551− "list_commit_comments": {
2552− "params": {
2553− "owner": "flagon-io",
2554− "name": "hello",
2555− "sha": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13"
2556− },
2557− "response": [
2558− {
2559− "id": "ccm_01m4a2r7k3d9f1h5j8n2q6t0w4",
2560− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2561− "commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2562− "path": "src/main.rs",
2563− "line": 12,
2564− "author": "ana",
2565− "body": "Should an empty name fall back to \"world\"?",
2566− "created_at": "2026-10-01T19:02:11.208Z",
2567− "updated_at": null
2568− }
2569− ],
2570− "notes": "Oldest first."
2571− },
2572− "create_commit_comment": {
2573− "params": {
2574− "owner": "flagon-io",
2575− "name": "hello",
2576− "sha": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13"
2577− },
2578− "request": {
2579− "body": "Should an empty name fall back to \"world\"?",
2580− "path": "src/main.rs",
2581− "line": 12
2582− },
2583− "response": {
2584− "id": "ccm_01m4a2r7k3d9f1h5j8n2q6t0w4",
2585− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2586− "commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2587− "path": "src/main.rs",
2588− "line": 12,
2589− "author": "ana",
2590− "body": "Should an empty name fall back to \"world\"?",
2591− "created_at": "2026-10-01T19:02:11.208Z",
2592− "updated_at": null
2593− },
2594− "notes": "`line` needs `path`, a file the commit changed, and counts lines of that file as the commit left it. A repository with `allow_commit_comments` off answers `403`; a commit it does not have, `404`. See [Commit comments](/guides/pull-requests/#commit-comments)."
2595− },
2596− "update_commit_comment": {
2597− "params": {
2598− "owner": "flagon-io",
2599− "name": "hello",
2600− "comment_id": "ccm_01m4a2r7k3d9f1h5j8n2q6t0w4"
2601− },
2602− "request": {
2603− "body": "Should an empty name fall back to \"world\"? The README says it does."
2604− },
2605− "response": {
2606− "id": "ccm_01m4a2r7k3d9f1h5j8n2q6t0w4",
2607− "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
2608− "commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
2609− "path": "src/main.rs",
2610− "line": 12,
2611− "author": "ana",
2612− "body": "Should an empty name fall back to \"world\"? The README says it does.",
2613− "created_at": "2026-10-01T19:02:11.208Z",
2614− "updated_at": "2026-10-01T19:05:40.117Z"
2615− },
2616− "notes": "Its author only."
2617− },
2618− "delete_commit_comment": {
2619− "params": {
2620− "owner": "flagon-io",
2621− "name": "hello",
2622− "comment_id": "ccm_01m4a2r7k3d9f1h5j8n2q6t0w4"
2623− },
2624− "notes": "Answers `204` with no body. Its author, or someone with the Maintain role or higher."
2625− },
26262107 "close_pull_request": {
26272108 "response": {
26282109 "id": "pr_01m43smh3vexsr5pmp60qwv0vs",
92868767 "deny_licenses": []
92878768 }
92888769 },
9289− "rerun_dependency_review": {
9290− "params": {
9291− "owner": "flagon-io",
9292− "name": "hello",
9293− "number": 12
9294− },
9295− "response": {
9296− "base": "4b1d7c0e9a2f6e3d8c5b0a7f4e1d2c3b4a5f6e7d",
9297− "head": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
9298− "changes": [
9299− {
9300− "change_type": "added",
9301− "manifest": "package-lock.json",
9302− "ecosystem": "npm",
9303− "name": "lodash",
9304− "version": "4.17.21",
9305− "relationship": "direct",
9306− "development": false,
9307− "license": "MIT",
9308− "purl": "pkg:npm/lodash@4.17.21",
9309− "vulnerabilities": [],
9310− "denied_license": false,
9311− "failing": false
9312− },
9313− {
9314− "change_type": "removed",
9315− "manifest": "package-lock.json",
9316− "ecosystem": "npm",
9317− "name": "lodash",
9318− "version": "4.17.20",
9319− "relationship": "direct",
9320− "development": false,
9321− "license": "MIT",
9322− "purl": "pkg:npm/lodash@4.17.20",
9323− "vulnerabilities": [],
9324− "denied_license": false,
9325− "failing": false
9326− }
9327− ],
9328− "passed": true,
9329− "headline": "2 dependency changes, none vulnerable",
9330− "fail_on": "high",
9331− "deny_licenses": []
9332− },
9333− "notes": "The pull request's one dependency review comment is changed in place; nothing new is posted when the review says the same."
9334− },
93358770 "get_security_settings": {
93368771 "params": {
93378772 "owner": "flagon-io",
1197511410 "response": {
1197611411 "access_level": "none"
1197711412 }
11978− },
11979− "get_actions_permissions": {
11980− "params": {
11981− "owner": "ada",
11982− "name": "hello"
11983− },
11984− "response": {
11985− "enabled": false,
11986− "enabled_chosen": false,
11987− "allowed_actions": "all"
11988− },
11989− "notes": "A fork's workflows are off until someone turns them on: here `ada/hello` is a fork nobody has chosen for yet. See [Forks](/concepts/forks/)."
11990− },
11991− "set_actions_permissions": {
11992− "params": {
11993− "owner": "ada",
11994− "name": "hello"
11995− },
11996− "request": {
11997− "enabled": true
11998− },
11999− "response": {
12000− "enabled": true,
12001− "enabled_chosen": true,
12002− "allowed_actions": "all"
12003− },
12004− "notes": "Needs the Admin role (`403` otherwise); a workflow job's own token is refused. Turning workflows on starts nothing by itself. See [Turn workflows off](/guides/actions/#turn-workflows-on-or-off)."
1200511413 },
1200611414 "set_actions_access": {
1200711415 "params": {
+1−12
154154 }
155155 match op {
156156 Op::GetWorkspace | Op::CreateWorkspace | Op::UpdateWorkspace => through::<g1t_contracts::identity::Workspace>(op, sent),
157− Op::ListRepos | Op::ListForks => through::<Vec<repos::Repo>>(op, sent),
158− Op::SyncFork => through::<repos::SyncedFork>(op, sent),
157+ Op::ListRepos => through::<Vec<repos::Repo>>(op, sent),
159158 Op::Search => through::<search::SearchResults>(op, sent),
160159 Op::GetRepo
161160 | Op::CreateRepo
162161 | Op::UpdateRepo
163162 | Op::TransferRepo
164− | Op::ForkRepo
165− | Op::DetachFork
166163 | Op::RenameRepo
167164 | Op::RenameBranch
168165 | Op::ArchiveRepo
196193 | Op::ReopenPullRequest
197194 | Op::ConvertPullRequestToDraft
198195 | Op::MergePullRequest
199− | Op::EnablePullRequestAutoMerge
200− | Op::DisablePullRequestAutoMerge
201− | Op::DeletePullRequestHeadBranch
202− | Op::RestorePullRequestHeadBranch
203196 | Op::RequestReviewers
204197 | Op::RemoveRequestedReviewers => {
205198 through::<work::Pull>(op, sent)
206199 }
207− Op::UpdatePullRequestBranch => through::<repos::PullBranchUpdate>(op, sent),
208− Op::GetPullRequestMergeOptions => through::<work::MergeChoices>(op, sent),
209− Op::ListRepoCommitComments | Op::ListCommitComments => through::<Vec<work::CommitComment>>(op, sent),
210− Op::CreateCommitComment | Op::UpdateCommitComment => through::<work::CommitComment>(op, sent),
211200 Op::ListWorkflows => through::<Vec<actions::Workflow>>(op, sent),
212201 Op::GetWorkflow => through::<actions::WorkflowDetail>(op, sent),
213202 Op::ListWorkflowRuns => through::<Vec<actions::WorkflowRun>>(op, sent),
+1−48
332332 route("GET", "/repos/:owner/:name/dependency-graph", Op::Security(SecurityOp::GetDependencyGraph), &[]),
333333 route("GET", "/repos/:owner/:name/dependency-graph/sbom", Op::Security(SecurityOp::GetSbom), &[]),
334334 route("GET", "/repos/:owner/:name/dependency-graph/compare/:basehead", Op::Security(SecurityOp::CompareDependencies), &[]),
335− route("POST", "/repos/:owner/:name/pulls/:number/dependency-review/rerun", Op::Security(SecurityOp::RerunDependencyReview), &[]),
336335 route("GET", "/repos/:owner/:name/security/settings", Op::Security(SecurityOp::GetSettings), &[]),
337336 route("PATCH", "/repos/:owner/:name/security/settings", Op::Security(SecurityOp::UpdateSettings), &[]),
338337 route("GET", "/workspaces/:workspace/security/settings", Op::Security(SecurityOp::GetWorkspaceSettings), &[]),
365364 route("GET", "/repos/:owner/:name/zipball/:ref", Op::Archives(ArchiveOp::DownloadZipball), &[]),
366365 route("PATCH", "/repos/:owner/:name", Op::UpdateRepo, &[]),
367366 route("POST", "/repos/:owner/:name/transfer", Op::TransferRepo, &[]),
368− route("POST", "/repos/:owner/:name/forks", Op::ForkRepo, &[]),
369− route("GET", "/repos/:owner/:name/forks", Op::ListForks, &[("limit", "limit")]),
370− route("POST", "/repos/:owner/:name/merge-upstream", Op::SyncFork, &[]),
371− route("POST", "/repos/:owner/:name/detach", Op::DetachFork, &[]),
372367 route("DELETE", "/repos/:owner/:name", Op::DeleteRepo, &[]),
373368 route(
374369 "GET",
503498 ),
504499 route("GET", "/repos/:owner/:name/actions/permissions/access", Op::Protection(ProtectionOp::GetActionsAccess), &[]),
505500 route("PUT", "/repos/:owner/:name/actions/permissions/access", Op::Protection(ProtectionOp::SetActionsAccess), &[]),
506− route("GET", "/repos/:owner/:name/actions/permissions", Op::Protection(ProtectionOp::GetActionsPermissions), &[]),
507− route("PUT", "/repos/:owner/:name/actions/permissions", Op::Protection(ProtectionOp::SetActionsPermissions), &[]),
508501 route("POST", "/repos/:owner/:name/dispatches", Op::Protection(ProtectionOp::CreateRepositoryDispatch), &[]),
509502 route(
510503 "GET",
11281121 Op::MergePullRequest,
11291122 &[],
11301123 ),
1131− route("GET", "/repos/:owner/:name/pulls/:number/merge-options", Op::GetPullRequestMergeOptions, &[]),
1132− route("PUT", "/repos/:owner/:name/pulls/:number/update-branch", Op::UpdatePullRequestBranch, &[]),
1133− route("PUT", "/repos/:owner/:name/pulls/:number/auto-merge", Op::EnablePullRequestAutoMerge, &[]),
1134− route("DELETE", "/repos/:owner/:name/pulls/:number/auto-merge", Op::DisablePullRequestAutoMerge, &[]),
1135− route("DELETE", "/repos/:owner/:name/pulls/:number/head-branch", Op::DeletePullRequestHeadBranch, &[]),
1136− route("POST", "/repos/:owner/:name/pulls/:number/head-branch/restore", Op::RestorePullRequestHeadBranch, &[]),
1137− // Commit comments: GitHub's addresses.
1138− route("GET", "/repos/:owner/:name/comments", Op::ListRepoCommitComments, &[("page", "page")]),
1139− route("PATCH", "/repos/:owner/:name/comments/:comment_id", Op::UpdateCommitComment, &[]),
1140− route("DELETE", "/repos/:owner/:name/comments/:comment_id", Op::DeleteCommitComment, &[]),
1141− route("GET", "/repos/:owner/:name/commits/:sha/comments", Op::ListCommitComments, &[]),
1142− route("POST", "/repos/:owner/:name/commits/:sha/comments", Op::CreateCommitComment, &[]),
11431124 // Artifacts mode's docs, slides, designs and dashboards. Search comes
11441125 // before an artifact by id, which it would otherwise match.
11451126 route("GET", "/workspaces/:workspace/artifacts", Op::Folios(FoliosOp::List), &[("tab", "tab"), ("kind", "kind"), ("space", "space"), ("project", "project"), ("q", "q"), ("state", "state"), ("cursor", "cursor"), ("limit", "limit")]),
11671148 pub fn no_content(&self) -> bool {
11681149 matches!(
11691150 self.op,
1170− Op::DeleteComment | Op::DeleteCommitComment | Op::Caches(CachesOp::DeleteCache)
1151+ Op::DeleteComment | Op::Caches(CachesOp::DeleteCache)
11711152 )
11721153 }
11731154
15261507 let (route, input) = resolve("PATCH", "/repos/acme/web/pulls/9", &[], json!({ "base": "release" })).unwrap();
15271508 assert_eq!(route.op, Op::UpdatePullRequest);
15281509 assert_eq!(input, json!({ "base": "release", "number": 9, "repo": "acme/web" }));
1529− }
1530−
1531− #[test]
1532− fn merging_settings_and_commit_comments_have_their_addresses() {
1533− let op = |method: &str, path: &str| resolve(method, path, &[], Value::Null).unwrap().0.op;
1534− assert_eq!(op("GET", "/repos/acme/web/pulls/9/merge-options"), Op::GetPullRequestMergeOptions);
1535− assert_eq!(op("PUT", "/repos/acme/web/pulls/9/update-branch"), Op::UpdatePullRequestBranch);
1536− assert_eq!(op("PUT", "/repos/acme/web/pulls/9/auto-merge"), Op::EnablePullRequestAutoMerge);
1537− assert_eq!(op("DELETE", "/repos/acme/web/pulls/9/auto-merge"), Op::DisablePullRequestAutoMerge);
1538− assert_eq!(op("DELETE", "/repos/acme/web/pulls/9/head-branch"), Op::DeletePullRequestHeadBranch);
1539− assert_eq!(op("POST", "/repos/acme/web/pulls/9/head-branch/restore"), Op::RestorePullRequestHeadBranch);
1540− let (route, input) = resolve("GET", "/repos/acme/web/comments", &[("page".to_owned(), "2".to_owned())], Value::Null).unwrap();
1541− assert_eq!(route.op, Op::ListRepoCommitComments);
1542− assert_eq!(input, json!({ "page": "2", "repo": "acme/web" }));
1543− let (route, input) =
1544− resolve("POST", "/repos/acme/web/commits/9f2c4e1/comments", &[], json!({ "body": "Why?", "path": "a.rs", "line": 3 })).unwrap();
1545− assert_eq!(route.op, Op::CreateCommitComment);
1546− assert_eq!(input, json!({ "body": "Why?", "path": "a.rs", "line": 3, "sha": "9f2c4e1", "repo": "acme/web" }));
1547− assert_eq!(op("GET", "/repos/acme/web/commits/9f2c4e1/comments"), Op::ListCommitComments);
1548− // Still a commit's statuses, beside its comments.
1549− assert_eq!(op("GET", "/repos/acme/web/commits/main/statuses"), Op::Checks(ChecksOp::ListCommitStatuses));
1550− let (route, input) = resolve("PATCH", "/repos/acme/web/comments/cc_1", &[], json!({ "body": "Better" })).unwrap();
1551− assert_eq!(route.op, Op::UpdateCommitComment);
1552− assert_eq!(input, json!({ "body": "Better", "comment_id": "cc_1", "repo": "acme/web" }));
1553− let (route, _) = resolve("DELETE", "/repos/acme/web/comments/cc_1", &[], Value::Null).unwrap();
1554− assert!(route.op == Op::DeleteCommitComment && route.no_content());
1555− // An issue's comments keep theirs.
1556− assert_eq!(op("PATCH", "/repos/acme/web/issues/comments/cmt_1"), Op::EditComment);
15571510 }
15581511
15591512 #[test]
+1−18
5454 GetDependencyGraph,
5555 GetSbom,
5656 CompareDependencies,
57− RerunDependencyReview,
5857 GetSettings,
5958 UpdateSettings,
6059 GetWorkspaceSettings,
7473 /// Every one: `Op::ALL` lists each as `Op::Security(…)`, which a test
7574 /// checks against this.
7675 #[cfg(test)]
77− pub const ALL: [SecurityOp; 39] = [
76+ pub const ALL: [SecurityOp; 38] = [
7877 SecurityOp::ListSecretAlerts,
7978 SecurityOp::GetSecretAlert,
8079 SecurityOp::UpdateSecretAlert,
10099 SecurityOp::GetDependencyGraph,
101100 SecurityOp::GetSbom,
102101 SecurityOp::CompareDependencies,
103− SecurityOp::RerunDependencyReview,
104102 SecurityOp::GetSettings,
105103 SecurityOp::UpdateSettings,
106104 SecurityOp::GetWorkspaceSettings,
143141 SecurityOp::GetDependencyGraph => "get_dependency_graph",
144142 SecurityOp::GetSbom => "get_sbom",
145143 SecurityOp::CompareDependencies => "compare_dependencies",
146− SecurityOp::RerunDependencyReview => "rerun_dependency_review",
147144 SecurityOp::GetSettings => "get_security_settings",
148145 SecurityOp::UpdateSettings => "update_security_settings",
149146 SecurityOp::GetWorkspaceSettings => "get_workspace_security_settings",
188185 SecurityOp::GetDependencyGraph => "Get the dependency graph",
189186 SecurityOp::GetSbom => "Export an SBOM",
190187 SecurityOp::CompareDependencies => "Compare dependencies",
191− SecurityOp::RerunDependencyReview => "Re-run dependency review",
192188 SecurityOp::GetSettings => "Get a repository's security settings",
193189 SecurityOp::UpdateSettings => "Update a repository's security settings",
194190 SecurityOp::GetWorkspaceSettings => "Get a workspace's security settings",
232228 SecurityOp::GetDependencyGraph => "Get the dependency graph: every package the lockfiles on the default branch resolve, per lockfile, with whether it is direct or transitive (where the lockfile says), for development, its license when recorded, its package URL and its open vulnerability alerts.",
233229 SecurityOp::GetSbom => "Export the dependency graph as an SPDX 2.3 JSON document, in sbom. Every package is named by its package URL.",
234230 SecurityOp::CompareDependencies => "Compare the dependencies at two commits, branches or tags (basehead, as base...head): what was added and removed per lockfile, with the known vulnerabilities of what was added and whether it passes the repository's dependency review policy. Needs the g1t plan on a private repository.",
235− SecurityOp::RerunDependencyReview => "Run the Dependency review check again on an open pull request's head, with the advisories known now: its status is set again and its one comment on the pull request is changed in place (or added, when it has dependency changes to show and none is there yet). Returns the review. g1t reviews a pull request by itself when it opens and when its head moves, carrying the result over when the head's lockfile changes are the ones reviewed before. Takes the Write role. Needs the g1t plan on a private repository.",
236231 SecurityOp::GetSettings => "Get a repository's security settings: when the Code scanning check fails, dependency review and its policy, whether secrets in the history open alerts, whether it takes private vulnerability reports, its workspace's settings, and whether the paid features are on for it.",
237232 SecurityOp::UpdateSettings => "Change a repository's security settings: code_scanning_gate (none, errors, critical, high, medium or any), dependency_review, review_fail_on (critical, high, medium, low or none), review_deny_licenses (SPDX ids), review_comment, history_alerts (whether secrets found in the history open alerts; push protection stays on) and private_vulnerability_reporting. Takes the Admin role, or a security manager of the workspace. Require the Code scanning and Dependency review checks in branch protection to gate merges on them.",
238233 SecurityOp::GetWorkspaceSettings => "Get a workspace's security settings (delegated bypass, validity checks) and whether it has Security and quality, which comes with the g1t plan.",
433428 &["repo", "id", "state"],
434429 ),
435430 SecurityOp::GetDependencyGraph | SecurityOp::GetSbom | SecurityOp::GetSettings => (json!({ "repo": repo() }), &["repo"]),
436− SecurityOp::RerunDependencyReview => (
437− json!({ "repo": repo(), "number": { "type": "integer", "description": "The pull request's number." } }),
438− &["repo", "number"],
439− ),
440431 SecurityOp::CompareDependencies => (
441432 json!({
442433 "repo": repo(),
10461037 };
10471038 pass(services, "dependency_review", &DependencyReviewArgs { viewer: viewer.clone(), repo, base, head }).await
10481039 }
1049− SecurityOp::RerunDependencyReview => {
1050− let Some(repo) = repo else { return failed(FailureCode::Invalid, &need_repo()) };
1051− let Some(number) = whole(input, "number").filter(|number| *number > 0) else {
1052− return failed(FailureCode::Invalid, "number is the pull request's number.");
1053− };
1054− pass(services, "rerun_dependency_review", &PullScanningArgs { viewer: viewer.clone(), repo, number }).await
1055− }
10561040 SecurityOp::GetSettings => {
10571041 let Some(repo) = repo else { return failed(FailureCode::Invalid, &need_repo()) };
10581042 pass(services, "security_settings", &SecuritySettingsArgs { viewer: viewer.clone(), repo }).await
12571241 }
12581242 assert_eq!(scope_for("get_sbom"), Some(Scope::SecurityRead));
12591243 assert_eq!(scope_for("upload_sarif"), Some(Scope::SecurityWrite));
1260− assert_eq!(scope_for("rerun_dependency_review"), Some(Scope::SecurityWrite));
12611244 // No run decides about security.
12621245 for name in ["bypass_push_protection", "review_bypass_request", "update_security_settings"] {
12631246 assert!(g1t_contracts::credentials::NEVER.contains(&name), "{name}");
+4−23
7070 Tool {
7171 name: "repository",
7272 title: "Repositories",
73− description: "Repositories: find, read and create them, change their settings and rulesets (what may happen to branches and tags, and what a pull request needs to merge), check their CODEOWNERS file, manage their labels and milestones, see and dismiss their security alerts (secrets and vulnerable dependencies), read what their default branch says (languages, contributors, license), star them, publish releases and comment on their commits. Name one as \"owner/name\". Deleting, transferring and changing visibility need `confirm`.",
73+ description: "Repositories: find, read and create them, change their settings and rulesets (what may happen to branches and tags, and what a pull request needs to merge), check their CODEOWNERS file, manage their labels and milestones, see and dismiss their security alerts (secrets and vulnerable dependencies), read what their default branch says (languages, contributors, license), star them and publish releases. Name one as \"owner/name\". Deleting, transferring and changing visibility need `confirm`.",
7474 default_action: None,
7575 actions: &[
7676 a("list", Op::ListRepos, "Repositories you can see"),
7777 a("get", Op::GetRepo, "One repository"),
7878 a("commits", Op::ListCommits, "A branch's commits with their messages (why each was made); with path, the commit that last changed it"),
79− a("commit_comments", Op::ListCommitComments, "A commit's comments, on it or on lines of its files"),
80− a("list_commit_comments", Op::ListRepoCommitComments, "All its commit comments, newest first"),
81− a("comment_on_commit", Op::CreateCommitComment, "Comment on a commit; path and line for one line of a file it changed"),
82− a("edit_commit_comment", Op::UpdateCommitComment, "Change your commit comment's text"),
83− a("delete_commit_comment", Op::DeleteCommitComment, "Delete a commit comment: your own, or any with the Maintain role"),
8479 a("contents", Op::GetContents, "A file's text, or a directory's entries and README, at a branch, tag or commit"),
8580 a("tarball", Op::Archives(ArchiveOp::DownloadTarball), "A 10-minute link to a branch, tag or commit as a .tar.gz"),
8681 a("zipball", Op::Archives(ArchiveOp::DownloadZipball), "A 10-minute link to a branch, tag or commit as a .zip"),
8782 a("create", Op::CreateRepo, "Create one, empty or copied from a public git URL"),
88− a("update", Op::UpdateRepo, "Change description, website, topics, default branch, protection, forking"),
83+ a("update", Op::UpdateRepo, "Change description, website, topics, default branch, protection"),
8984 a("get_settings", Op::GetRepoSettings, "How pull requests merge, and the default branch's protection as its rules stack"),
9085 a("update_settings", Op::UpdateRepoSettings, "Change how pull requests merge and the default branch protection ruleset"),
9186 a("check_names", Op::ListCheckNames, "Check names reported lately, to require in a ruleset"),
128123 a("delete_branch", Op::DeleteBranch, "Delete a branch; make it again at its commit to restore it"),
129124 a("rename", Op::RenameRepo, "Rename it; old addresses redirect"),
130125 a("transfer", Op::TransferRepo, "Move it to another workspace you own"),
131− a("fork", Op::ForkRepo, "Fork it into a workspace: its code and description, linked to it"),
132− a("forks", Op::ListForks, "Its forks you can see"),
133− a("sync_fork", Op::SyncFork, "Bring a fork's branch up to date with its parent"),
134− a("detach_fork", Op::DetachFork, "Make a fork an ordinary repository, no longer linked to its parent"),
135126 a("archive", Op::ArchiveRepo, "Make it read-only"),
136127 a("unarchive", Op::UnarchiveRepo, "Make it writable again"),
137128 a("set_visibility", Op::SetRepoVisibility, "Make it public or private"),
175166 Tool {
176167 name: "pull_request",
177168 title: "Pull requests",
178− description: "Pull requests: start a change for an issue, record your session, mark it ready, ask people and teams to review, review, update its branch, and merge (by merge, squash, rebase or fast_forward) now or with auto-merge. Read `overlaps` and `behind` on `get` before going far, and `code_owners` for whose approval it needs.",
169+ description: "Pull requests: start a change for an issue, record your session, mark it ready, ask people and teams to review, review and merge. Read `overlaps` and `behind` on `get` before going far, and `code_owners` for whose approval it needs.",
179170 default_action: None,
180171 actions: &[
181172 a("list", Op::ListPullRequests, "Pull requests on a repository, newest first"),
194185 a("review", Op::ReviewPullRequest, "Approve or request changes"),
195186 a("close", Op::ClosePullRequest, "Close without merging"),
196187 a("reopen", Op::ReopenPullRequest, "Reopen a closed one"),
197− a("merge", Op::MergePullRequest, "Land it (merge, squash, rebase or fast_forward), or join the merge queue"),
198− a("merge_options", Op::GetPullRequestMergeOptions, "How it may merge now: methods, default messages, whether it is behind"),
199− a("update_branch", Op::UpdatePullRequestBranch, "Bring its branch up to date with its base, by merge or rebase"),
200− a("enable_auto_merge", Op::EnablePullRequestAutoMerge, "Merge it on its own once its checks, reviews and rules allow"),
201− a("disable_auto_merge", Op::DisablePullRequestAutoMerge, "Turn its auto-merge off"),
202− a("delete_branch", Op::DeletePullRequestHeadBranch, "Delete a merged or closed one's branch; restorable"),
203− a("restore_branch", Op::RestorePullRequestHeadBranch, "Make its deleted branch again at its head"),
188+ a("merge", Op::MergePullRequest, "Land it, or join the merge queue"),
204189 a("merge_queue", Op::GetMergeQueue, "The repository's merge queue"),
205190 ],
206191 },
276261 a("set_approval_policy", Op::Protection(ProtectionOp::SetForkPrApproval), "Set which pull requests' runs wait for approval"),
277262 a("get_access", Op::Protection(ProtectionOp::GetActionsAccess), "Which repositories may use this one's actions and workflows"),
278263 a("set_access", Op::Protection(ProtectionOp::SetActionsAccess), "Let the workspace's private repositories use them, or not"),
279− a("get_enabled", Op::Protection(ProtectionOp::GetActionsPermissions), "Whether its workflows run at all; off for a fork until turned on"),
280− a("set_enabled", Op::Protection(ProtectionOp::SetActionsPermissions), "Turn its workflows on or off"),
281264 a("repository_dispatch", Op::Protection(ProtectionOp::CreateRepositoryDispatch), "Start repository_dispatch workflows with an event"),
282265 a("get_workspace_permissions", Op::Protection(ProtectionOp::GetWorkspaceWorkflowPermissions), "A workspace's default and maximum token permissions"),
283266 a("set_workspace_permissions", Op::Protection(ProtectionOp::SetWorkspaceWorkflowPermissions), "Set them, and whether jobs may open pull requests"),
515498 a("dependency_graph", Op::Security(SecurityOp::GetDependencyGraph), "Every package the lockfiles resolve, direct or transitive"),
516499 a("sbom", Op::Security(SecurityOp::GetSbom), "The dependency graph as an SPDX 2.3 document"),
517500 a("compare_dependencies", Op::Security(SecurityOp::CompareDependencies), "What changes in dependencies between base...head"),
518− a("rerun_dependency_review", Op::Security(SecurityOp::RerunDependencyReview), "Run a pull request's Dependency review check again"),
519501 a("settings", Op::Security(SecurityOp::GetSettings), "A repository's security settings"),
520502 a("update_settings", Op::Security(SecurityOp::UpdateSettings), "Change when checks fail and dependency review's policy"),
521503 a("workspace_settings", Op::Security(SecurityOp::GetWorkspaceSettings), "A workspace's delegated bypass and validity checks"),
652634 | Op::DeleteTeam
653635 | Op::RemoveTeamRepo
654636 | Op::MergePullRequest
655− | Op::DeleteCommitComment
656637 | Op::RemoveRunner
657638 | Op::DeleteRunnerGroup
658639 | Op::UpdateRunnerSettings
+3−3
713713 checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a"
714714 dependencies = [
715715 "quote",
716− "syn 3.0.7",
716+ "syn 2.0.119",
717717 ]
718718
719719 [[package]]
34873487
34883488 [[package]]
34893489 name = "rustls"
3490−version = "0.23.45"
3490+version = "0.23.46"
34913491 source = "registry+https://github.com/rust-lang/crates.io-index"
3492−checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
3492+checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
34933493 dependencies = [
34943494 "once_cell",
34953495 "ring",
+1−2
Loading the diff…
+18−29
Loading the diff…
+3−5
Loading the diff…
+45−160
Loading the diff…
+6−7
Loading the diff…
+0−37
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…
Loading the diff…