Commit graph

49 commits

Author SHA1 Message Date
William Martin
db8b38a185 Fix secret command panic when base repo from cwd 2025-03-06 11:45:22 +01:00
Andy Feller
23ea61d325 Expand gh secret base repo tests
Building on top of the work done in commands to account for GH_REPO environment variable, this commit expands existing tests around handling base repo functions to include new test scenarios.

These tests fail in the same way as reported on the issue when run against `trunk` without the other branch's changes, demonstrating they will help avoid regression.
2025-03-04 13:39:38 -05:00
Azeem Sajid
d67d65e304 [gh secret] Check GH_REPO too in addition to --repo for disambiguation 2025-03-04 18:36:53 +01:00
William Martin
e7ffb1e435 Fix typo in secret base repo selection comment 2025-01-15 14:55:18 +01:00
William Martin
88a64d2a11 Change wording on secret repo prompt 2025-01-15 14:55:17 +01:00
William Martin
b382b24728 Print informative message before prompting for secret repo 2025-01-15 14:55:17 +01:00
William Martin
4da4c82090 Rename secret BaseRepo func 2025-01-15 14:55:17 +01:00
William Martin
870da79886 Use smarter base repo funcs for secret commands 2025-01-15 14:55:17 +01:00
William Martin
73244c010e Move secret repo validation into secrets subpackage 2025-01-15 14:55:17 +01:00
Wing
57c9ee0ad2 Add tests for secret commands
Co-authored-by: William Martin <williammartin@github.com>
2025-01-15 14:55:16 +01:00
Wing
88988374b5 Add remote check to secret commands
Co-authored-by: William Martin <williammartin@github.com>
2025-01-15 14:55:16 +01:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
Babak K. Shandiz
d034a69164
Add comment to explain showSelectedReposInfo assignment
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-04 20:09:28 +01:00
Babak K. Shandiz
4aa7e75cd1
Rename const to avoid CodeQL error
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-04 20:06:45 +01:00
Babak K. Shandiz
d8ff343d5c
Add tests to verify numSelectedRepos is populated when necessary
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-04 19:49:34 +01:00
Babak K. Shandiz
e42b8b7e6b
Populate numSelectedRepos only if needed
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-04 19:48:44 +01:00
Babak K. Shandiz
d687bc7908
Add test cases to verify exported JSON has non-zero numSelectedRepos
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-01 22:08:18 +01:00
Babak K. Shandiz
148f9527c1
Populate numSelectedRepos in non-interactive mode, if explicitly selected
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-01 22:07:53 +01:00
w1mvy
9dd5805f9c
Add json export flags to variable list command (#8516) 2024-01-17 10:09:09 -08:00
Yukai Chou
1ac1609bb7 Use "GitHub Actions" as a whole 2023-11-23 07:20:11 +08:00
Heath Stewart
7738b6187c
Add headers to all tables (#8157) 2023-10-20 11:20:02 +02:00
rajhawaldar
79296c0a62
Use camelCase for fields
Signed-off-by: rajhawaldar <rajhawaldar.in@gmail.com>
2023-09-29 13:02:59 +05:30
rajhawaldar
965eabd503
Support standard output format flags for secret and deploy-key list
Signed-off-by: rajhawaldar <rajhawaldar.in@gmail.com>
2023-09-25 21:35:47 +05:30
Sam Coe
41a457136e
Tech debt cleanup for variable and secret commands (#7151) 2023-03-15 01:03:56 +00:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
vilmibm
f5d19b831e error instead of prompt when no base repo + fixes 2022-12-15 11:44:37 -08:00
Mislav Marohnić
3fe5026d39
Migrate to tableprinter from go-gh (#6346) 2022-10-17 15:15:39 +02:00
Ashwin Jeyaseelan
b47ed57694 Revert "Revert "Added functionality for org-level codespaces secrets (#6171)" (#6223)"
This reverts commit eaabd35b76.
2022-09-15 15:53:28 -07:00
Ashwin Jeyaseelan
eaabd35b76
Revert "Added functionality for org-level codespaces secrets (#6171)" (#6223)
This reverts commit bde64b3191.
2022-09-09 08:18:03 +04:00
Ashwin Jeyaseelan
bde64b3191
Added functionality for org-level codespaces secrets (#6171) 2022-09-08 09:40:53 +04:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Roshan Padaki
13342cb272
Don't error on list commands when no results found (#5479)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-04-25 17:55:52 +00:00
Josh Gross
31c6ba3807
Support listing and removing Dependabot secrets (#5160)
* Support listing and removing Dependabot secrets

* Remove duplicated tests
2022-03-17 11:42:12 +02:00
Christian Gregg
c5dbf20ed4
Alias list as ls for all commands (#5214)
I always get tripped up whenever trying to list my codespaces, adding
`ls` as an alias to `list` feels natural enough.

Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-02-17 13:53:42 +01:00
Mislav Marohnić
4a3ef50d2d
Standardize pager output across commands (#5141)
Add pager functionality to the following commands:
- gist list
- pr checks
- release list
- run list
- run view
- secret list
- workflow list
- workflow view

Additionally, normalize error handling when starting the pager has
failed: only print a non-fatal notice to stderr instead of aborting the
whole command.
2022-02-01 08:36:51 +01:00
Josh Gross
577f29ae0d
Support listing and removing user Codespaces secrets (#4714) 2021-11-18 12:53:35 +01:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Robin Neatherway
0e51ec1699 Correct benign mistake in off-by-one guard
m[2] is the third element of m, rather than the second, so we have to
check instead that the len of m is at least 3.

Because the regular expression has two capture groups, the length of m
will always be 3, so currently the guard will always be true.
2021-08-19 14:41:04 +01:00
Tyler Wright
e5bdaaab2c Add ability to list environment secrets
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-05-31 21:15:10 +02:00
Mislav Marohnić
260f720c07 💅 refactor and add tests for Secrets pagination 2021-05-31 20:40:53 +02:00
Gowtham Munukutla
cb60538709 paginate to get all secrets at once 2021-05-31 20:39:32 +02:00
Mislav Marohnić
ac348b0dec Fix requesting REST sub-resources on GHE
GitHub REST resources typically return full URLs to fetch related
resources at. We used to parse those URLs to find just the path portion
and pass that in to the `REST()` function, which only accepted paths. By
doing so, we are essential de-constructing a URL just to re-assemble it
again. While re-assembling it for Enterprise, though, we would
accidentally inject an extra `api/v3/` prefix where one was not needed.

The solution is just to use raw URLs as reported by the REST API with
no modifications. This extends the `REST()` function to accept full URLs
in addition to just paths to resources.
2021-04-19 12:41:09 +02:00
Sam
9ec1e21d4c
Default to GHES host if only GHES is authenticated (#3286) 2021-03-30 16:51:00 +02:00
Mislav Marohnić
fc77cbc964 Deprecate test.ExpectLines
For asserting command output, exact string matches are preferred in most cases. In cases when a pattern match is needed, the test can use regexp ad hoc.
2021-01-18 23:25:45 +01:00
vilmibm
3306351162 use type for Visibility 2020-12-10 15:11:08 -08:00
vilmibm
2e6639fe78 show number of selected repositories in secret list 2020-12-10 14:59:37 -08:00
vilmibm
c036e6699c remove implied org functionality from secret list 2020-12-10 12:36:57 -08:00
vilmibm
5309a2089a implement gh secret create and gh secret list 2020-12-04 16:47:23 -08:00