Commit graph

66 commits

Author SHA1 Message Date
ferhat elmas
70470f9cef refactor: drop multierror in favor of std
Drop github.com/hashicorp/go-multierror
in favor of https://pkg.go.dev/errors#Join (go1.20).

Related to #11468

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
2025-12-02 15:08:58 +01:00
William Martin
502b64582d Support --no-repos-selected on secret set 2025-07-03 17:02:28 +02:00
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
ce47fabc27 Move secret base repo prompting earlier 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
William Martin
df8bb51c9c Always prompt on secret set when multiple remotes 2025-01-15 14:55:17 +01:00
Wing
3de2fd94b3 Prompt for secret commands
Co-authored-by: William Martin <williammartin@github.com>
2025-01-15 14:55:16 +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
Viktor Szépe
6d9dd57774 Fix typos 2024-05-09 20:15:27 +00:00
Nero Blackstone​
93113e12ea
Add colon at the end of secret prompts (#9004) 2024-04-26 12:58:45 +02:00
Yukai Chou
1ac1609bb7 Use "GitHub Actions" as a whole 2023-11-23 07:20:11 +08:00
Nate Smith
fc73c16fe8 use prompter in secret set 2023-08-16 21:26:57 -05:00
Michael Bianco
c5b642fc5f
docs: example of setting multiple vars using stdin 2023-07-10 11:37:41 -06:00
Anupam Kumar
88cc4d2531
Add variable set command (#6928) 2023-03-13 03:01:38 +00:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
Sam Coe
1233bd4439
Special case setting dependabot org secrets (#6941) 2023-02-02 07:12:22 +11:00
Josh Gross
f6431ca001
Use int64 repository IDs for Codespaces user secrets 2023-01-27 14:36:35 -05:00
vilmibm
f5d19b831e error instead of prompt when no base repo + fixes 2022-12-15 11:44:37 -08: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
vilmibm
41385477c3 fix linting 2022-07-27 14:15:27 -05:00
vilmibm
d5334f4115 Revert "update linter checks"
This reverts commit 40ecb8c188.
2022-07-27 13:30:41 -05:00
vilmibm
40ecb8c188 update linter checks 2022-07-26 16:06:52 -05: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
Josh Gross
f6d2f83938
Support setting Dependabot secrets (#5134)
* Support setting Dependabot secrets

* lint: Remove unnecessary assignment

* Use `StringEnumFlag` helper for Application input

* Add Dependabot to command description

* Move repository name mapping after input validation

* Error when multiple secret entities are set

* Return an error for invalid apps

* Use `assert` instead of `require`
2022-03-15 07:44:51 +02:00
Mislav Marohnić
19563c4a74 Use StringEnumFlag helper in more places 2022-02-18 12:52:47 +01:00
Sam Coe
3be4b9951d
Trim leading and trailing whitespace when setting secrets from stdin (#5086)
* Trim leading and trailing whitespace when setting secrets from stdin

* Only trim newline at end of string
2022-01-29 09:32:14 +02:00
Mislav Marohnić
e43cb2b880 Port more legacy stubs to the new ask stubber 2022-01-14 19:34:15 +01:00
Mislav Marohnić
95a71f75c5 Improve setting multiple secrets
- Store multiple secrets in parallel
- Perform repo ID resolution in parallel with looking up the encryption key
- Avoid resolving repo IDs more than once
- Allow passing `--env-file=-` to read from stdin
- Fix storing user secrets from file
2021-12-20 23:35:31 +01:00
lpessoa
5589583e4d Adding set secrets from env files
Allows to set multiple secrets from an env file.

    gh secret set -f secrets.env

The env file follows a simple format as defined in https://github.com/joho/godotenv

    SPAM=eggs
    FOO="bar"
2021-12-20 23:33:54 +01:00
Sergio Guzmán Mayorga
f13f0e7d87
Add secret set --no-store to print the encrypted secret (#4423)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-12-02 16:05:10 +00:00
Josh Gross
e82958b4e0
Support setting user Codespaces secrets (#4699)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-11-18 12:55:24 +01:00
Alan Donovan
f4491c7a80 Add FlagErrorf; encapsulate FlagError.error 2021-10-21 11:40:20 -04:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
90b7886142 Fix unmarshalling GraphQL error type
The "path" field of a GraphQL error object contains a mix of strings and
numbers and cannot be deserialized into `[]string`. Fortunately, we
don't need to rely on the "path" field and instead have the final error
message be constructed by aggregating human-readable "message" fields.
2021-08-04 15:34:53 +02:00
Mislav Marohnić
3a7ce3a440 Fix setting environment secrets
This uses the correct public key when setting environment secrets.
https://docs.github.com/en/rest/reference/actions#get-an-environment-public-key
2021-06-14 11:51:20 +02:00
Bruno Alla
4d46447eb3 Fix description for gh secret set --env option 2021-06-04 15:29:01 +01:00
vilmibm
0931531e2f collapse conditional 2021-06-02 13:27:19 -05:00
Bruno Alla
32856c987d Add ability to set environments secrets 2021-06-02 15:56:33 +01:00