Commit graph

3376 commits

Author SHA1 Message Date
Heath Stewart
2758b80013
Remove unnecessary --help comment 2024-04-15 21:38:16 -07:00
Heath Stewart
4ea7bcacb3
Run defers in queue 2024-04-04 01:26:10 -07:00
Heath Stewart
a76af8588c
Resolve PR comments 2024-04-04 01:26:09 -07:00
Heath Stewart
e83e049306
Wrap JSON arrays, objects in array with --slurp
Effectively copies `jq --slurp` since `--jq` already uses the same grammar.
2024-04-04 01:26:05 -07:00
Heath Stewart
f41876d64c
Resolve PR comments 2024-04-04 01:21:04 -07:00
Heath Stewart
0dfe6ec4b4
Clarify --merge-pages docs
Only works when piping or redirecting stdout.
2024-04-04 01:21:03 -07:00
Heath Stewart
48f0cd6f11
Replace --paginate-all with --merge-pages 2024-04-04 01:21:02 -07:00
Heath Stewart
310e5524ba
Resolve test issues 2024-04-04 01:21:01 -07:00
Heath Stewart
e7f5dded06
Add more JSON merge tests 2024-04-04 01:21:00 -07:00
Heath Stewart
a65103667e
Move jsonmerge package to internal 2024-04-04 01:20:57 -07:00
Heath Stewart
8e27e9a8cd
Merge JSON responses from gh api
Partly resolves cli/cli#1268 and replaces cli/cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
2024-04-04 01:06:43 -07:00
William Martin
96a75139f8
Merge pull request #8888 from satoqz/trunk
Fix segfault in error handling of `gh repo rename`
2024-04-02 16:28:09 +02:00
Meredith Lancaster
90b7bf97c5
gh-attestation cmd integration (#8698)
* add attestation cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add codeowners

Signed-off-by: Meredith Lancaster <malancas@github.com>

* update args passed to the attestation cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use gh-attestation branch for passing iostreams from the root

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add package security team entry to codeowners

Signed-off-by: Meredith Lancaster <malancas@github.com>

* start moving over verify cmd and general verification code

Signed-off-by: Meredith Lancaster <malancas@github.com>

* clean up common and verify specific policy code

Signed-off-by: Meredith Lancaster <malancas@github.com>

* move artifact package over

Signed-off-by: Meredith Lancaster <malancas@github.com>

* start pulling in the github api client wrapper

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix imports

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add logger and test packages

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add additional packages to support verify command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix mock api client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* clean up mock api client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* include missing fields

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use correct owner

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add more mock api client options

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add download cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add inspect cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pass factory object to inspect cmd, add inspect sub cmd to attestation cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add verify-tuf-root cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pass iostream struct from command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename logger pkg to logger

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix path in codeowners

Signed-off-by: Meredith Lancaster <malancas@github.com>

* formatter

Signed-off-by: Meredith Lancaster <malancas@github.com>

* go mod tidy

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix printf linter issue

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix printf linter issue

Signed-off-by: Meredith Lancaster <malancas@github.com>

* check user's GH host for compatibility

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pass oci client to commands directly

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* mark tuf-root-verify cmd hidden

Signed-off-by: Meredith Lancaster <malancas@github.com>

* move client initialization back to subcommands

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add more verbose options and logging

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add missing logger

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add testing around OCI and API client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add integration test

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix file path

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* build executable before integration test

Signed-off-by: Meredith Lancaster <malancas@github.com>

* split integration tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove integration test steps

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix flag value

Signed-off-by: Meredith Lancaster <malancas@github.com>

* run integration tests on ubuntu for now

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pull over doc updates

Signed-off-by: Meredith Lancaster <malancas@github.com>

* delete unused test data

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove Go patch version

Signed-off-by: Meredith Lancaster <malancas@github.com>

* switch assert to require

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* move integration tests to prexisting test workflow

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use platform matrix for integration tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* simplify build step

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use StringEnumFlag handling

Signed-off-by: Meredith Lancaster <malancas@github.com>

* typo

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use the iostreams.Test helper func

Signed-off-by: Meredith Lancaster <malancas@github.com>

* create interface for oci client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add tests for oci client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* rename files

Signed-off-by: Meredith Lancaster <malancas@github.com>

* format file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix shellcheck issues

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use testing TempDir method

Signed-off-by: Meredith Lancaster <malancas@github.com>

* cleanup unused tempdir handling

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use table driven tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* check correct cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* support repo option in download sub cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* switch over to using RunE

Signed-off-by: Meredith Lancaster <malancas@github.com>

* unexport top level subcommand funcs

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add comment around keychain option

Signed-off-by: Meredith Lancaster <malancas@github.com>

* update comments

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix inconsistent naming

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add tests for CLI commands

Signed-off-by: Meredith Lancaster <malancas@github.com>

* check for noattestationsfound err

Signed-off-by: Meredith Lancaster <malancas@github.com>

* try out metadata abstraction instead

Signed-off-by: Meredith Lancaster <malancas@github.com>

* switch to using MetadataStore abstraction

Signed-off-by: Meredith Lancaster <malancas@github.com>

* include test case with failing metadata store

Signed-off-by: Meredith Lancaster <malancas@github.com>

* look for err specific to file write

Signed-off-by: Meredith Lancaster <malancas@github.com>

* unexport fields

Signed-off-by: Meredith Lancaster <malancas@github.com>

* return err when an unsupported hash alg is provided

Signed-off-by: Meredith Lancaster <malancas@github.com>

* PrintTableToStdOut returns err when rendering fails

Signed-off-by: Meredith Lancaster <malancas@github.com>

* start adding sigstore verifier unit tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add more sigstore verifier specific tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use cli table printer

Signed-off-by: Meredith Lancaster <malancas@github.com>

* return JSON results in slice instead of table

Signed-off-by: Meredith Lancaster <malancas@github.com>

* move mock client to test file

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove unneeded table printer method

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add initial tests for tufrootverify cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* formatting

Signed-off-by: Meredith Lancaster <malancas@github.com>

* cleanup method

Signed-off-by: Meredith Lancaster <malancas@github.com>

* close file in error handling branch

Signed-off-by: Meredith Lancaster <malancas@github.com>

* normalize artifact path

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove unneeded embedded file system

Signed-off-by: Meredith Lancaster <malancas@github.com>

* include image name reference err

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use GH_DEBUG value for io handling

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove quiet and verbose flags

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add more tufrootveriify tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* GitHubTUFOptions no longer needs to return error

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove unneeded slice

Signed-off-by: Meredith Lancaster <malancas@github.com>

* normalize all relative paths

Signed-off-by: Meredith Lancaster <malancas@github.com>

* clean up nil client checks

Signed-off-by: Meredith Lancaster <malancas@github.com>

* set api server based on host

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add comment about http client

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use format flag to handle json output in verify cmd

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use format flag to handle json output

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use normalized path for cli test arg

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add tests for json output

Signed-off-by: Meredith Lancaster <malancas@github.com>

* cleanup error wrapping

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use test fixtures correctly by normalizing path

Signed-off-by: Meredith Lancaster <malancas@github.com>

* dont clean

Signed-off-by: Meredith Lancaster <malancas@github.com>

* escape backwards slash for windows files with replace

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use strings.Split func

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use strings.Replace for all command tests

Signed-off-by: Meredith Lancaster <malancas@github.com>

* use CLI cache dir to store tuf metadata

Signed-off-by: Meredith Lancaster <malancas@github.com>

* Tweaked docstrings for gh attestation download

* Tweaked docstrings for gh attestation verify

* Fix for bug in gh attestation where the wrong hostname was being passed to the API client.

* lets hide tuf-root-verify eh?

* Forgot verify's short str.

* add remote verification test

Signed-off-by: Meredith Lancaster <malancas@github.com>

* Revert "add remote verification test"

This reverts commit c0ceb99ca8.

* update json result handling

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add json tags to struct returned by command

Signed-off-by: Meredith Lancaster <malancas@github.com>

* fix how json results are handled

Signed-off-by: Meredith Lancaster <malancas@github.com>

* add test to ensure JSON output is valid

Signed-off-by: Meredith Lancaster <malancas@github.com>

---------

Signed-off-by: Meredith Lancaster <malancas@github.com>
Co-authored-by: Phill MV <phillmv@github.com>
2024-04-01 11:13:47 -06:00
satoqz
176420907b
fix segfault in gh repo rename 2024-03-29 14:38:27 +01:00
ihommani
1cac2280aa Fix typo in auth switch help example 2024-03-23 20:56:09 +00:00
yasunori
b54f7a3bde
Include draft ID in project item list JSON (#8754) 2024-03-20 12:58:51 +01:00
William Martin
90fc403813 Document run watch and view not supporting fine grained PATs 2024-03-19 14:52:43 +01:00
William Martin
0f5d2aed0a Document auth switch behaviour for two or more accounts 2024-03-18 17:24:38 +01:00
Josh Soref
6ff355049c
Improve discovery of gh auth status 2024-03-18 12:09:27 -04:00
Roman Podoliaka
0d84970bbb
Fix the description of gh release upload
The formatting verb is used incorrectly and produces a misleading
help text for this command:

```
To define a display label for an asset, append text starting with %#% after the file name.
```

instead of the expected:

```
To define a display label for an asset, append text starting with `#` after the file name.
```
2024-03-18 11:19:20 +00:00
Victor Martinez
c0658b7ab4
feat: support dry-run in gh pr create (#8376) 2024-03-14 16:28:53 +01:00
Andy Feller
dc804d9287
Merge pull request #8778 from cli/repo_in_merge_prompt
feat: consistent issue and PR owner/repo#number in various prompt
2024-03-12 12:16:26 -04:00
Greg Smith
df446b47fc fixed doc string 2024-03-06 14:08:59 -08:00
Andy Feller
2b2571eb23 Fix breaking test for PR/issue # change 2024-03-01 16:04:24 -05:00
Andy Feller
bcdc917f08 Enhance 2nd round of issue and PR number output 2024-03-01 15:42:43 -05:00
Andy Feller
3bb5f54073 Apply first round of owner/repo#number consistency
This commit expands on @nobe4 initial work by bringing the owner and repository name to the most obvious issue and PR number output use cases before making a second pass for any edge cases.
2024-03-01 14:03:18 -05:00
Harvey Sanders
9dd102ffd0
Support project view --web with TTY (#8773) 2024-03-01 17:45:29 +01:00
nobe4
a5b7c6122d
fix: format files 2024-03-01 13:35:09 +01:00
nobe4
db93444ba9
feat(merge): add owner/repo in prompt
Various places during the `gh pr merge` flow show the PR number and
title. Those places are updated to also show the owner/repo.

E.g.
Before:
  Pull request #123 (title) is ready to be merged
After:
  Pull request owner/repo#123 (title) is ready to be merged

There are other places, where only the number is displayed. Those were
intentionally left as is. It made sense to show the owner/repo only when
the extra context of the title was present.

It also fixes the related tests.

cc #8777
2024-03-01 13:26:20 +01:00
William Martin
337ae29769
Merge pull request #8738 from stuart-leitch/docs/clarify-archived-repo-beahaviour-when-searching-prs
Clarify helptext for search prs regarding archived repos
2024-03-01 10:30:21 +01:00
Stuart Leitch
cfd2d645b2 Clarify helptext for gh search issues and gh search repos regarding archived repos 2024-02-29 22:38:55 +00:00
William Martin
0d4bf83a41
Merge pull request #8595 from benebsiny/cli-7849
Link Project to Repository or Team Command
2024-02-29 17:02:39 +01:00
William Martin
9dc23559c1
Merge pull request #8711 from toshimaru/add-cache-ref-optoion-to-cache-list
feat: Add `ref` option to `gh cache list`
2024-02-29 13:30:50 +01:00
William Martin
b7ea025475 Make minor cache list ref flag adjustments 2024-02-29 13:02:49 +01:00
William Martin
2ee6737053 Use regex to split apart the git client Commit logs
Theoretically this should be clearer and more robust than the previous
version which had some custom loop logic while trying to parse newlines
and determine whether it had reached a new commit entry by trying to parse
a git sha. This would not have worked correctly if a commit body contained
a sha on a new line.
2024-02-27 20:49:00 +01:00
William Martin
2b0484f5aa Use null byte separators when fetching comments from git 2024-02-27 18:00:40 +01:00
Stuart Leitch
19367c6458 fixed whitespace 2024-02-21 23:31:57 +00:00
Stuart Leitch
25c1610e37 Clarify helptext for search prs regarding archived repos 2024-02-21 23:17:19 +00:00
William Martin
24481c5c2e
Merge pull request #8715 from dean-tate/dean-tate/8712-fix-repo-variable-update-msg
bug: fixed the msg returned for patching a repo variable
2024-02-20 14:58:31 +01:00
Dean Tate
a3601a7eca bug: fixed the result.Operation variable prior to patchRepoVariable being called in the setVariable function. 2024-02-18 11:12:01 +11:00
William Martin
81be2b67ee Remove mainLoop label from garden 2024-02-17 13:45:39 +01:00
toshimaru
818c158212
feat: Add ref option to gh cache list
List GitHub Actions caches with `ref` filtering.

> ref string
> The full Git reference for narrowing down the cache. The ref for a branch should be formatted as refs/heads/<branch name>. To reference a pull request use refs/pull/<number>/merge.

ref. https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository
2024-02-17 09:28:06 +09:00
William Martin
658e7ac889 Ensure PRs with one commit have title and body prefilled 2024-02-16 16:30:44 +01:00
William Martin
14617e59e9 Update test to run against trunk 2024-02-16 16:30:00 +01:00
William Martin
237f6e3435 Test PR create uses commit title and body when only one commit 2024-02-16 16:19:02 +01:00
benebsiny
66fb5738a3 chore: simplify parameter owner 2024-02-15 23:24:32 +08:00
benebsiny
7dfaa328aa Support for [HOST/]OWNER/REPO format 2024-02-15 23:16:00 +08:00
benebsiny
874da37a24 Replace assert with require in testing 2024-02-15 18:38:50 +08:00
benebsiny
9225102a67 Merge branch 'trunk' of github.com:cli/cli into trunk 2024-02-15 18:33:37 +08:00
William Martin
8948ee8c3b
Merge pull request #8667 from toshimaru/add-cache-key-optoion-to-cache-list
feat: Add cache key option to `gh cache list`
2024-02-12 11:34:15 +01:00