Commit graph

5446 commits

Author SHA1 Message Date
Babak K. Shandiz
2dd54ae921
refactor(cache delete): simplify error handling
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 10:08:04 +01:00
Babak K. Shandiz
842d3449b4
refactor(cache delete): simplify condition
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 10:02:03 +01:00
Kynan Ware
b939188e6d Refactor agent task tests into table-driven format
Consolidates multiple individual test functions into a single table-driven test, improving maintainability and readability. This change makes it easier to add new test cases and ensures consistent test structure for agent task command authentication scenarios.
2025-08-27 17:20:45 -06:00
Kynan Ware
1bc2710c88 Refactor test to use require.Empty assertion
Replaces require.Equal with require.Empty in TestOAuthTokenAccepted for improved clarity when checking for empty output.
2025-08-27 17:07:35 -06:00
Kynan Ware
2128a297b3 Show help on agent-task command execution
Changed the RunE function of the agent-task command to display help output instead of returning nil, improving user guidance when the command is run without arguments.
2025-08-27 17:06:19 -06:00
Kynan Ware
3573f61b86 Add agent-task command with OAuth token validation
Introduces a new `agent-task` command under pkg/cmd/agent with strict OAuth (device flow) token validation. Includes comprehensive tests for token source and host validation, and registers the command in the root command set.
2025-08-27 12:23:01 -06:00
Lucas
926327ce6d
fix(cache): validate --ref flag usage with cache ID
* Ensure that the `--ref` flag cannot be used in conjunction with a cache ID.
* Update error handling to provide clear feedback when this condition is violated.
* Add tests to cover scenarios involving the `--ref` flag and cache ID.
2025-08-27 19:54:19 +02:00
Lucas
1a19918581
fix(cache): prevent using --ref flag with cache ID
* Added validation to ensure that the `--ref` flag cannot be used when a cache ID is provided.
* Updated error message to include the reference when a cache is not found with the specified `--ref`.
2025-08-27 19:38:01 +02:00
Lucas
5c292286cf
refactor(cache): extract cache ID parsing logic
* Replaced direct conversion of cache ID string to int with a dedicated `parseCacheID` function.
* Improved readability and maintainability of the `deleteCaches` function.
2025-08-27 19:37:39 +02:00
Lucas
047326fcb4
fix(cache): update error message for missing cache key with --ref flag
* Changed the error message from "--ref cannot be used without cache key/ID" to "must provide a cache key" for clarity.
* Updated corresponding test case to reflect the new error message.
2025-08-27 04:56:48 +02:00
Lucas
3ba82b58a9
chore(cache): improve help text for --ref flag in cache deletion
* Clarified the description of the `--ref` flag to specify its purpose more accurately.
* Ensures users understand that it narrows down deletion by cache key and ref.
2025-08-27 04:56:48 +02:00
Lucas
bfb1354e51
test(cache): add tests for --ref flag in cache deletion
* Implemented test cases for handling the `--ref` flag in cache deletion commands.
* Added validation for using `--ref` with cache key and ID.
* Ensured proper error messages are returned for invalid usage of `--ref`.
2025-08-27 04:56:48 +02:00
Lucas
aff2bfaa5c
feat(cache): add support for --ref flag in cache deletion
- Introduced `--ref` flag to narrow down cache deletion to a specific branch or PR reference.
- Updated command examples to include usage of `--ref`.
- Added validation to ensure `--ref` cannot be used with `--all` and must accompany a cache key/ID.
2025-08-27 04:56:46 +02:00
minxinyi
21b08bdd20
refactor: use slices.Equal to simplify code (#11364)
Signed-off-by: minxinyi <minxinyi6@outlook.com>
2025-08-26 15:29:19 -06:00
Kynan Ware
e1a1040f37
Merge branch 'trunk' into auth-status-json-output-8635 2025-08-25 10:00:43 -06:00
Andrey
4e1318eb2a
feat: gh auth Automatically copy one-time OAuth code to clipboard (#11518)
* feat: add ability to copy one-time OAuth code while authenticating

Signed-off-by: Andrey <andrekabatareika@gmail.com>

* fix(docs): wrong example for gh auth refresh

* chore(authflow): update message to include one-time code to it

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>

* chore(authflow): improve message when copied one-time code

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>

* chore(authflow): don't early return error when could not copy OAuth code

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>

* refactor(authflow): make code for working with OAuth code more readable

* Adjust language in `gh auth` help for clipboard

---------

Signed-off-by: Andrey <andrekabatareika@gmail.com>
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
2025-08-25 09:52:51 -06:00
Andrey
204536cdd0
docs(release create): difference --generate-notes and --notes-from-tag (#11534)
* docs(release create): distinguish difference between '--generate-notes' and '--notes-from-tag'

Signed-off-by: Andrey <andrekabatareika@gmail.com>

* Clarify release notes behavior for unannotated tags

Updated help text to specify that if a git tag is not annotated, the release notes will use the commit message instead of the tag annotation.

---------

Signed-off-by: Andrey <andrekabatareika@gmail.com>
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
2025-08-25 15:20:21 +00:00
Andrey
89512590ad
Add --force flag to gh run cancel (#11513)
* feat: add --force flag to run cancel command

Signed-off-by: Andrey <andrekabatareika@gmail.com>

* docs: use less prescriptive docs for --force flag

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>

* chore: remove short flag

Signed-off-by: Andrey <andrekabatareika@gmail.com>

---------

Signed-off-by: Andrey <andrekabatareika@gmail.com>
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
2025-08-21 12:45:12 -06:00
Benjamin Levesque
78675e73e1
fix show token when using json 2025-08-20 21:01:31 +02:00
Benjamin Levesque
48bc79a291
fix exit code 2025-08-20 20:26:27 +02:00
Benjamin Levesque
085f31fed8
revert showToken change 2025-08-20 20:07:57 +02:00
Benjamin Levesque
c937e0275d
mutually exclusive flags 2025-08-20 20:02:41 +02:00
Benjamin Levesque
faa0e2c26b
flag duplicate check 2025-08-20 20:02:00 +02:00
Benjamin Levesque
6e6c09e6b1
add ExpectCommandToSupportJSONFields 2025-08-20 19:36:09 +02: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
Benjamin Levesque
3d02e248c0
do not export authState 2025-08-20 17:50:29 +02:00
Benjamin Levesque
96755eec83
handle -t conflict 2025-08-20 09:05:20 +02:00
Benjamin Levesque
3ffe199ef3
do not fetch scope if not necessary 2025-08-20 01:04:09 +02:00
Benjamin Levesque
8b553d66cc
json flags 2025-08-20 00:27:31 +02:00
Benjamin Levesque
fd19da8e55
auth state enum 2025-08-19 23:43:22 +02:00
Benjamin Levesque
0091384495
Refactor entry to a single type 2025-08-19 22:54:31 +02:00
Benjamin Levesque
c5fc7e3ffb
Fix missing assertions 2025-08-19 22:37:25 +02:00
Andy Feller
9ae764b9fa
Merge pull request #11514 from cli/github-cli-937-v1-project-ghes-deprecation
Ensure users can see v2 projects when viewing issues and PRs, avoid v1 projects on GHES 3.17 and newer
2025-08-18 16:15:54 -04:00
Eugene
5ae174b6b3
Merge pull request #11511 from cli/eugene/trusted_root_flag_for_release_verify
Hidden trusted root flag for release verify
2025-08-15 16:58:19 -04:00
Eugene
7316ddc57d
Update pkg/cmd/release/verify/verify.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-14 16:08:44 -04:00
Eugene
e23c9d087d
Update pkg/cmd/release/verify-asset/verify_asset.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-14 16:08:37 -04:00
ejahnGithub
79888378d8 Hidden trusted root flag for release verify 2025-08-14 14:00:55 -04:00
ejahnGithub
c4d14044c7 udpate the test 2025-08-13 14:42:50 -04:00
ejahnGithub
2d9cf84690 replace /git/refs/tags/ to /git/ref/tags/ 2025-08-13 11:23:06 -04:00
Andy Feller
746da6de00 Update PR tests for v2 projects 2025-08-12 21:13:18 -04:00
Andy Feller
72f5fbbec0 Base changes for PR project items 2025-08-12 20:59:50 -04:00
Andy Feller
7851c9c664 Update gh issue view to show v2 projects
These changes enhance the existing `gh issue view` experience by listing v2 projects in interactive and non-interactive forms.

Additionally, the tests have been enhanced to use a more standard `httpStubs` approach from other tests.
2025-08-12 16:18:45 -04:00
ejahnGithub
ec086af25c add test for FetchRefSHA 2025-08-08 17:32:30 -04:00
Eugene
82eb05bb24
Merge branch 'trunk' into eugene/fetch-ref-handle-ReleaseNotFound 2025-08-08 13:29:04 -04:00
Kynan Ware
b5a6913a17
Merge branch 'trunk' into 10480-enhance-gh-search-docs 2025-08-06 10:34:25 -06:00
Kynan Ware
4dde0871bd Fix linter 2025-08-06 10:32:46 -06:00
Kynan Ware
3d9bd69e11
Update pkg/cmd/search/search.go 2025-08-06 10:28:56 -06:00
ejahnGithub
1beb8252a7 fix error for ErrReleaseNotFound when fetching ref 2025-08-04 20:58:45 -04:00
Sukh
6e400eb4a1 docs(search): move search syntax note to gh search --help 2025-08-02 03:01:40 -04:00
Andy Feller
bbc3d02cb3 Refactor tab completion test
This commit moves the `gh pr create` tab completion test closer to the logic rather than the commands that use it.

This should ensure that any command or flag that lists reviewers will present teams and users as expected.
2025-07-30 09:25:33 -04:00