Commit graph

676 commits

Author SHA1 Message Date
yuvrajangadsingh
198487e166 fix: address review feedback on squash merge commit message
- reorder if checks: validate --enable-squash-merge is set before
  checking the value, and error when --enable-squash-merge=false
- use validSquashMsgValues directly in interactive prompt instead of
  duplicating the slice
- use slices.Contains in validateSquashMergeCommitMsg
- interpolate const values in Long description instead of hardcoding
- add default clause in transformSquashMergeOpts to avoid mutating
  title/message on unknown input
- move optionDiscussions to end of const block with TODO comment
- add test for unknown input and --enable-squash-merge=false case
2026-03-10 18:27:21 +05:30
yuvrajangadsingh
3baf83a339 fix: gofmt alignment in test struct literals 2026-03-10 16:55:50 +05:30
yuvrajangadsingh
4ae0c5851b feat(repo): add --squash-merge-commit-message flag to gh repo edit
Add a single --squash-merge-commit-message flag that maps to both
squash_merge_commit_title and squash_merge_commit_message API fields.

Supported values:
- default: COMMIT_OR_PR_TITLE + COMMIT_MESSAGES
- pr-title: PR_TITLE + BLANK
- pr-title-commits: PR_TITLE + COMMIT_MESSAGES
- pr-title-description: PR_TITLE + PR_BODY

The flag requires --enable-squash-merge to be set alongside it. In
interactive mode, the squash merge commit message prompt appears when
squash merging is selected.

Closes #10092
2026-03-10 16:55:50 +05:30
Kynan Ware
6e979c6b32
Merge pull request #12686 from 4RH1T3CT0R7/add-no-upstream-flag
Add --no-upstream flag to repo clone
2026-03-03 16:01:05 -07:00
Kynan Ware
6045a593a3
Reword --no-upstream help doc 2026-03-03 15:51:27 -07:00
Kynan Ware
1c36686a61
Merge branch 'trunk' into 2722-fix-fork-remote-flag 2026-03-02 10:22:27 -07:00
Kynan Ware
9de48154de Add missing TODO comments for featuredetection if-statements
Add greppable TODO identifiers above all if-statements that reference
featuredetection struct fields, as required by the featuredetection
linter. This ensures every feature detection branch is tagged for
future cleanup when GHES gains support.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-16 14:24:32 -07:00
4RH1T3CT0R7
fa95f3a21b Add --no-upstream flag to gh repo clone
When cloning a forked repository, `gh repo clone` automatically adds the
parent repo as an `upstream` remote and sets it as the default repository.
This can be problematic when the user lacks access to the parent repo,
the upstream fetch is expensive for large repos, or the user simply
doesn't want the upstream remote.

Add a `--no-upstream` flag that skips adding the upstream remote when
cloning a fork. When used, origin (the fork) is set as the default
repository instead. The flag is mutually exclusive with
`--upstream-remote-name`. For non-fork repos the flag is a harmless
no-op.

Closes #8274
2026-02-14 20:31:02 +03:00
lif
1d506f5331
fix: simplify set-default remote parsing 2026-01-14 18:35:04 +08:00
majiayu000
5f305e81c2
Handle repo argument before remote name 2026-01-10 00:54:51 +08:00
majiayu000
73c7fd59ef feat: allow git remote names in gh repo set-default
When specifying a repository for `gh repo set-default`, users can now
use a git remote name (e.g., "origin", "upstream") instead of the
full OWNER/REPO format.

The command first checks if the argument is a git remote name. If
found, it uses the corresponding repository. Otherwise, it falls
back to parsing the argument as OWNER/REPO format.

Example:
  gh repo set-default origin

Fixes #9149

Signed-off-by: majiayu000 <1835304752@qq.com>
2025-12-26 19:21:11 +08:00
majiayu000
3f0044fd94 fix: error when --remote flag used with repo argument
When a repository argument is provided to `gh repo fork`, the command
operates independently of the current local repository. Using --remote
in this context is incompatible because there's no local repository to
add the remote to.

This change returns an explicit error when these flags are combined,
providing clear feedback instead of silently ignoring the --remote flag.

Fixes #2722

Signed-off-by: majiayu000 <1835304752@qq.com>
2025-12-26 14:43:52 +08:00
Babak K. Shandiz
0e53651bb2
docs(repo garden): improve func godoc
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-11-03 20:05:27 +00:00
Babak K. Shandiz
d002d30327
fix: resolve nilerr issues
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-11-03 20:05:26 +00:00
Babak K. Shandiz
2709c39179
refactor(repo garden): return pagination link instead of resp
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-11-03 20:05:25 +00:00
Babak K. Shandiz
9f65e89760
fix: close resp body (bodyclose)
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-11-03 20:05:25 +00:00
Babak K. Shandiz
d129b94fc5
refactor: remove returned resp from api.EndpointNeedsScopes
The returned response from `api.EndpointNeedsScopes` causes `bodyclose`
linter to raise a false positive error, assuming it's a new response that
its body needs to be closed.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-11-03 20:05:24 +00:00
Shion Ichikawa
a7f14576aa
(repo delete) remove comprehensive assertions on check stderr output 2025-10-29 08:47:34 +09:00
Shion Ichikawa
7083f6dda4
💡 (gh repo delete) Add warning when --yes is ignored without a repository, Closes: #12033 2025-10-29 03:13:51 +09:00
Babak K. Shandiz
ef69901f05
refactor(search): rename Query.String to StandardSearchString
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-08 16:04:47 +01:00
Copilot
5eddf8d523
Merge pull request #11536 from cli/copilot/fix-11535
Fix `gh repo delete --yes` safety issue when no repository argument provided
2025-08-20 11:03:44 -06:00
Andy Feller
29a94ab9b1 Reformat non-documentation hostnames
Outside of the hostnames previously fixed, I talked with @williammartin about what to do with the remaining references and the concern about the mixed format.

One suggestion for the error / test use case was to remove the extraneous text all together.
2025-07-14 08:43:15 -04:00
Andy Feller
313d20ba83 Ensure hostnames are visible in CLI website
This commit changes <github.com> and <ghe.com> references to `github.com` and `ghe.com` so they are visible on the GitHub CLI marketing website.

GitHub Pages will render URLs with a protocol as clickable links, however hostnames are treated as HTML elements and not rendered.
2025-07-14 08:33:20 -04:00
Babak K. Shandiz
284880c21e
Fix StatusJSONResponse usage (#10810)
* Fix `StatusJSONResponse` usage

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Replace `assert` with `require`

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Improve assertion against errors

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Add `JSONErrorResponse` helper func

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Use `httpmock.JSONErrorResponse`

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Replace `StatusJSONResponse` to `JSONErrorResponse` for better readibility

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Fix improper use of `StatsJSONResponse`

Signed-off-by: Babak K. Shandiz <babakks@github.com>

---------

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-05-01 20:22:43 +01:00
Kynan Ware
19633d3855
Merge pull request #10516 from iamazeem/8430-show-hostname-in-repo-creation-prompts
[gh repo create] Show host name in repo creation prompts
2025-04-09 14:30:56 -06:00
Andy Feller
918cafc222 Deprecate ColorScheme.Gray for ColorScheme.Muted
This commit converts all of the places using ColorScheme.Gray and ColorScheme.Grayf to Muted and Mutedf.

There is a little extra tidying up with local variable names or converting code to use Mutedf format.
2025-04-06 10:18:48 -04:00
Andy Feller
d2cd14b4cd Remove out of scope changes, update list commands
After discussing this with the team, the `gh config` changes to display `accessible_colors` have been removed from this branch being outside of acceptance criteria.  This will be moved to a separate issue along with any other work needed to finalize the public preview such as `gh help` entries for `GH_ACCESSIBLE_COLORS` environment variable.

List commands that use ColorScheme.Gray have been updated to use ColorScheme.Muted.
2025-03-31 11:58:30 -04:00
Kynan Ware
c1fbc2f05b test(many): fix whitespace in tests expectations
Due to https://github.com/charmbracelet/glamour/pull/334, the margin
used for markdown rendering has changed by a couple spaces. This
corrects the relevant tests to accomodate that change.
2025-03-27 14:21:13 -06:00
Kazuma Watanabe
b01288617a Make missing workflow regexp aware of GitHub App
Follow up of https://github.com/cli/cli/pull/7612

The `missingWorkflowScopeRE` is defined to capture
the error message when the `GH_TOKEN` does not have
`workflow` scope in `gh repo sync <remote>`,
but this is only intended for error messages for
OAuth Apps and does not work with GitHub Apps.

In GitHub App, you will get the following error:

```
{
  "message": "refusing to allow a GitHub App to create or update workflow `.github/workflows/teamcity-pr-checks.yml` without `workflows` permission",
  "documentation_url": "https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository",
  "status": "422"
}
```

As you can see above, the existing regexp does not
match the "`workflows` permission".

This change modifies the regexp to return
the user-friendly error message when the `workflow`
permission is missing, even in the case of a GitHub App.
2025-03-11 02:38:51 +00:00
Azeem Sajid
a1136bf5cd Add initial test 2025-03-09 12:19:16 +05:00
Azeem Sajid
cc3dd515a6 Show host name in repo creation prompts 2025-02-28 12:25:49 +05:00
Andy Feller
f9d50d86ac
Merge pull request #10508 from iamazeem/10449-inconsistent-examples-format
Inconsistent format of examples in help text
2025-02-27 09:15:14 -05:00
Azeem Sajid
33c30d5bd1 Inconsistent format of examples in help text 2025-02-27 16:26:25 +05:00
Azeem Sajid
69fff52026
Inconsistent format of description of flags (starting with lowercase letter) (#10507) 2025-02-27 11:40:21 +01:00
Azeem Sajid
0fb87903e5 Update usage to lower-kebab-case 2025-02-14 22:12:22 +05:00
Tyler McGoffin
e047d4a611
Merge pull request #10429 from iamazeem/8404-standardize-urls
Standardize URLs
2025-02-13 10:49:18 -08:00
Azeem Sajid
f9428e7905 Update tests 2025-02-13 11:09:57 +05:00
Azeem Sajid
8b7fb231ec Remove trailing whitespace 2025-02-13 11:06:27 +05:00
Azeem Sajid
026f64ce6f Standardize URLs 2025-02-13 10:41:53 +05:00
Andy Feller
cdb44f8298
Merge pull request #10334 from iamazeem/9132-gh-repo-view-set-default
[gh repo view] Improve error message for forked repo
2025-02-12 09:55:13 -05:00
Azeem Sajid
eb44ec2d86 Update tests 2025-02-11 10:34:10 +05:00
Azeem Sajid
cdc7cae29c Address review comments 2025-02-11 09:35:16 +05:00
Michael Hoffman
8e2be7326b Improve http error test cases 2025-02-07 16:51:19 -05:00
Michael Hoffman
9eaaf44516 Handle non-TTY behavior 2025-02-07 16:27:04 -05:00
Michael Hoffman
7a5b49a4c4
Merge branch 'trunk' into delete-autolinks 2025-02-06 09:53:09 -05:00
Tim Rogers
430e5abe25
Drop accidental help text change 2025-02-03 12:04:42 +00:00
Tim Rogers
6c21ab2284
Error when gh repo rename is used with a new repo name that contains an owner
`gh repo rename` can only rename a repo, but not change its owner
(i.e. transfer it).

As flagged in #10034, at the moment, the CLI behaves like it can do
this, and produces weird results.

If I ask to rename my repo to `polyseam/frappe-containers`:

```bash
gh repo rename polyseam/frappe-containers
```

..the preview suggests that it will do the right thing:

```
? Rename polyseam/containers to polyseam/frappe-containers? Yes
```

...but the repo gets renamed wrongly:

```
✓ Renamed repository polyseam/polyseam-frappe-containers
```

This adds an upfront validation that looks for a slash and tells
you that the command can't transfer a repo.

Fixes #10034.
2025-02-03 11:49:21 +00:00
Michael Hoffman
d5adafd3fb Rename staggler 2025-02-02 21:46:56 -05:00
Michael Hoffman
a1ae68b4f4 Formatting 2025-02-02 21:37:34 -05:00
Michael Hoffman
021557912d AuoLink -> Autolink 2025-02-02 21:34:03 -05:00