Commit graph

5685 commits

Author SHA1 Message Date
Andy Feller
97eb8a194e Simplifying cleanExtensionUpdateDir logic
This function was doing some unnecessary heavy lifting detecting if the directory being deleted actually existed when `os.RemoveAll()` would handle directories that exist or not.
2025-01-10 14:29:55 -05:00
Andy Feller
20062233c8 Separate logic for checking updates
During discussion in cli/cli#9934, we can to the conclusion that the logic around checking for core GitHub CLI updates would diverge from GitHub CLI
extension updates over time.  To that end, this commit splits that logic into a separate function with a new environment variable.
2025-01-10 14:16:46 -05:00
Tyler McGoffin
74cbd50d3f Restore old error functionality of prSelectorForCurrentBranch
Before this refactor, the errors emitted by ghrepo.FromURL and
rem.FindName() were suppressed. It isn't clear whether this was
intentional or not, but we've made the decision here to maintain the
original error behavior while still refactoring the return values for more
clarity. I've left a comment at each error handling block to explain this
decision.

Additionally, I've added the necessary git command stubs to the other
tests in status_test.go so that the tests are now passing.
2025-01-10 10:52:01 -08:00
nobe4
69b17272d6
fix: add back colon that I removed 2025-01-10 17:17:14 +01:00
nobe4
69ab0c9c85
fix: actually read how MaxFunc work and simplify the code 2025-01-10 16:31:13 +01:00
nobe4
1899b83509
fix: padded display
Apply code suggestion from @andyfeller from:
- https://github.com/cli/cli/pull/10194#discussion_r1909761552
- https://github.com/cli/cli/pull/10194#discussion_r1909764278
2025-01-10 16:28:50 +01:00
William Martin
889c4c75f3 Collapse dryrun checks in ext bin upgrade 2025-01-10 16:06:01 +01:00
Michael Hoffman
c09b5fa551
Merge branch 'trunk' into create-autolinks 2025-01-10 09:46:59 -05:00
Daniel A. Ochoa
d621b75ee7
Merge branch 'trunk' into gh-gist-delete-prompt 2025-01-10 01:25:19 -06:00
danochoa
7f71681ace gist delete - use in confirmation and success info 2025-01-10 01:07:11 -06:00
Tyler McGoffin
4c8d124d37
Merge pull request #10194 from nobe4/fancier-extention-upgrade
feat: make the extension upgrade fancier
2025-01-09 14:59:52 -08:00
Daniel A. Ochoa
928db3e66f
Merge branch 'trunk' into gh-gist-delete-prompt 2025-01-09 16:36:15 -06:00
Michael Hoffman
1207cef42b
Merge branch 'trunk' into create-autolinks 2025-01-09 16:06:06 -05:00
Tyler McGoffin
3d2748789e Rename test user in tests 2025-01-09 12:58:31 -08:00
Tyler McGoffin
100f9b473f Change pr number in test 2025-01-09 12:57:23 -08:00
Tyler McGoffin
e4f0b79173 Surface and handle error from ReadBranchConfig in parseCurrentBranch
I've only added the one test for parseCurrentBranch because the function
appears to be largely exercised by TestFind. There's definitely an
opportunity for a bigger refactor of the tests, here, but I want to avoid
scope creep as I propagate the ReadBranchConfig api changes throughout the
codebase
2025-01-09 12:46:55 -08:00
Tyler McGoffin
e4320ccc4b Directly stub headBranchConfig in Test_tryDetermineTrackingRef 2025-01-09 11:58:33 -08:00
Tyler McGoffin
e1423cdbbf Refine error handling of ReadBranchConfig
cmd.Output() will return an error when the git command ran successfully
but had no output. To handle this, we can check Stderr, as we expect it to
be populated for any ExitErrors or otherwise when there is a command
failure.

This allows for propagation of this error handling up the call chain, so
we are now returning errors if the call to git fails instead of just
handing off an empty BranchConfig and suppressing the errors.

Additionally, I've removed some more naked returns that I found in
pkg/cmd/pr/create.go createRun
2025-01-09 11:45:15 -08:00
Tyler McGoffin
d4f7576e8b Add test for empty BranchConfig in prSelectorForCurrentBranch 2025-01-09 09:01:14 -08:00
Mateus Marquezini
4c2ba5681d #10042 removed unnecessary field 2025-01-09 13:14:27 -03:00
Andy Feller
954d4d5dbc
Correct help documentation around template use in gh issue create
Relates #10202 

While we figure out how to handle consistent experience using templates for creating issues and PRs, let's correct the help usage for issue template flag use as this is the issue template name, not filename.
2025-01-09 11:08:18 -05:00
Mateus Marquezini
f4f8840c3f #10042: Add error messages for 'gh gist view/edit' prompts when no TTY is detected 2025-01-09 12:07:15 -03:00
danochoa
dccbc99fdf fix gist description in tests 2025-01-08 20:47:50 -06:00
danochoa
9c65a32ef8 gist delete prompt with gist description 2025-01-08 17:56:02 -06:00
Tyler McGoffin
15ac566222 Remove shadowed errors from prSelectorForCurrentBranch and cover with tests 2025-01-08 15:21:05 -08:00
Tyler McGoffin
94b2d4ec3b Added tests to cover prSelectorForCurrentBranch for confidence in refactor 2025-01-08 15:00:38 -08:00
Tyler McGoffin
ec9eaef048 Refactor prSelectorForCurrentBranch and tests
Replace the git config argument in prSelectorForCurrentBranch with
the branchConfig it was used to fetch. The tests needed to be refactored
accordingly to support this change to the prSelectorForCurrentBranch API.
In addition, I've moved the test to a table test format so I can expand
the test coverage in the next commit.
2025-01-08 14:34:49 -08:00
Meredith Lancaster
c2fdac272c update table column headers
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-08 13:27:38 -07:00
Tyler McGoffin
fea46c0011 Change ReadBranchConfig error message in gh pr create 2025-01-08 11:40:42 -08:00
Meredith Lancaster
1c16e12a66 update test fixtures to include buildConfigURI
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-08 11:16:23 -07:00
Meredith Lancaster
8ad877b188 add check for invalid attestation
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-08 08:38:43 -07:00
Mateus Marquezini
a3a283ca83 Merge branch 'trunk' into fix/issue_10042 2025-01-08 09:08:41 -03:00
danochoa
7d1d261c82 Merge branch 'trunk' into gh-gist-delete-prompt 2025-01-08 02:30:21 -06:00
danochoa
a8f0aaeb3d tentative updates for acceptance criteria
- pending confirmation re description in prompt
2025-01-08 02:22:21 -06:00
Meredith Lancaster
33d0002d21 update tests to use new function name
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 15:22:02 -07:00
Meredith Lancaster
8d89dd97fd
Update pkg/cmd/attestation/api/client.go
Co-authored-by: Phill MV <phillmv@github.com>
2025-01-07 15:14:53 -07:00
Meredith Lancaster
51a74aed1d
Update pkg/cmd/attestation/api/client.go
Co-authored-by: Phill MV <phillmv@github.com>
2025-01-07 15:14:23 -07:00
Tyler McGoffin
c83cf32cff Remove named return values from prSelectorForCurrentBranch 2025-01-07 13:54:43 -08:00
Tyler McGoffin
bf6fdbdfd2 Remove named returns from ReadBranchConfig and surface errors 2025-01-07 13:54:43 -08:00
Meredith Lancaster
42cb2547cd remove old comment
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 14:13:50 -07:00
Meredith Lancaster
1e91828cdf remove commented out code
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 13:36:50 -07:00
Meredith Lancaster
eb9eb261f0
Merge branch 'trunk' into update-attestation-verify-table-output 2025-01-07 12:14:01 -07:00
Meredith Lancaster
d4f3fbce9b
Merge branch 'trunk' into fetch-artifact-attestation-bundles-with-sas-url 2025-01-07 12:04:12 -07:00
Meredith Lancaster
f46cccbab4 comment
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 12:03:49 -07:00
Meredith Lancaster
258c69cd26 undo more name chanages
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 11:56:05 -07:00
Meredith Lancaster
0a602fae07 undo other name change
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 11:54:02 -07:00
Meredith Lancaster
37e0969f20 remove spaces
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 11:51:51 -07:00
Meredith Lancaster
3c0280c4d7 undo name change for now
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 11:51:23 -07:00
Meredith Lancaster
7838e912b6 more mock http client cleanup
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 11:37:02 -07:00
Meredith Lancaster
9d88ca8cf8 simplify mock http client
Signed-off-by: Meredith Lancaster <malancas@github.com>
2025-01-07 11:32:49 -07:00