Commit graph

3682 commits

Author SHA1 Message Date
crystalstall
5562c1489f chore: fix some function names
Signed-off-by: crystalstall <crystalruby@qq.com>
2024-09-02 15:18:42 +08:00
Zongle Wang
192f57ef42
Improve the help message for -F (#9525)
Changing to `release-notes.md` from `changelog.md` may help users better contextually understand usage.

Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-08-28 11:00:46 -07:00
Andy Feller
327451627c
Merge pull request #9509 from muzimuzhi/typo/repo-sync
Fix doc typo for `repo sync`
2024-08-28 09:29:24 -04:00
Aryan Bhosale
8305a49c3f
"offline" verification using the bundle of attestations without any additional handling of the file (#9523) 2024-08-26 09:58:29 -06:00
Andy Feller
19daa35c81
Merge pull request #9482 from benebsiny/cli-9153
fix the trimming of log filenames for `gh run view`
2024-08-22 15:23:06 -04:00
Tyler McGoffin
91eb34011c
Remove Internal from gh repo create prompt when owner is not an org (#9465)
* Remove `Internal` from `gh repo create` prompt when owner is not an org

Closes #9464

Internal repos only exist for organizations, so when a user selects their
personal namespace to create a repo using `gh repo create`, `Internal`
should not be an option in the `Visibility` prompt.

This should avoid the additional quirk where if the user selects
`Internal` while creating a personal repo and then proceeds to add any
of the README, .gitignore, or LICENSE files prompted for later, the repo
will not error and instead get created as a `Public` repo. This has the
potential for a user to unknowingly leak sensitive info intended to go
into a non-public repo.

* Refactor prompter with test coverage

By extracting the repo visibility options to its own function,
getRepoVisibilityOptions, we're able to directly test the behavior
introduced with this change. This breaks the testing pattern established
here thus far, but may be a good example of the direction we should
explore for a future refactor.

* Add failing tests to check for error with internal vis in non-org repos

There is a bug in the code, currently, where a user repo can attempt to be
created as with `--internal` visibility flag  when that is not an option
for non-org repos. It fails at the API level if the --gitignore,
--license, or --add-readme flags are not included, but silently falls back
to Public visibility if one of them is included.

Because this bug already existed, this commit adds the tests to ensure
that both scenarios described above are captured accurately by the test
suite. A fix for the latter scenario will be coming in a future commit

* Add Exclude to httpmock registry and implement in Test_repoCreate

Upon attempting to make the previous commit pass, I realized that it was
actually impossible to test what I wanted to. The tests in the previous
commit were behaving as expected given the bug that commit described, but
upon attempting to implement a solution I realized that the tests were
only testing the mocks and not the code functionality itself.

Essentially, when the code to fix the bug was implemented, the tests were
failing because the mocks required to test the buggy behavior were no
longer being called. To make the tests pass, I'd have to rewrite them, but
were I to remove the bug fix, the tests would no longer fail.

This pointed me to a gap in our httpmocks - the ability to intentionally
exclude api calls. The behavior I'm trying to test, here, is that we stop
executing when a certain condition is met, and therefore won't make any
subsequent api calls down the chain.

This implements the Exclude method on the registry such that it will fail
if an excluded api pattern is called. I have refactored the tests in
Test_repoCreate to use the Exclude mock for testing.

* Add error if user attempts to create repo with --internal flag

This was previously failing at either the API if no other flags were
included or falling back to creating a public repo if one of gitignore,
license, or add-readme were included.

* Add testing for error messages in gh repo create

In the previous commits, we've introduced a new error when a user tries to
create an Internal repo not owned by an organization. This adds tests to
verify that the error we are getting is, in fact, the one associated with
this use case and not some random error.
2024-08-22 10:01:16 -07:00
Yukai Chou
2374e82633 Fix doc typo for repo sync 2024-08-23 00:17:31 +08:00
Eugene
ef9069a1b0
Merge pull request #9421 from cli/eugene/attestation/fetch-oci-bundle
Fetch bundle from OCI registry for verify
2024-08-22 09:54:03 -04:00
Yukai Chou
c81ccab4b8
Quote repo names consistently in gh repo sync stdout (#9491)
* Quote repo names consistently in `gh repo sync` stdout

* Update tests
2024-08-21 12:20:45 -07:00
Andy Feller
779a1203b6
Merge pull request #9471 from heaths/issue9470
Always print URL scheme to stdout
2024-08-21 14:46:52 -04:00
Eugene
e21d053faf
Merge branch 'trunk' into eugene/attestation/fetch-oci-bundle 2024-08-21 12:24:08 -04:00
ejahnGithub
0d38a2fd8e fixed the test 2024-08-21 10:52:42 -04:00
ejahnGithub
47a8f4bbdd update error message 2024-08-20 16:14:39 -04:00
Andy Feller
95a2f95f75
Merge pull request #9453 from cli/jtmcg/project-v2-syntax-in-search
Update `--project <number>` flags in `gh search` to `owner/number`
2024-08-20 07:42:17 -04:00
Andy Feller
4f681aaee1
Merge pull request #9477 from benebsiny/cli-9496
fix behavior for `gh issue develop -b does-not-exist-on-remote`
2024-08-19 16:42:07 -04:00
ejahnGithub
3fd309bdde rename flag to bundle-from-oci 2024-08-19 10:29:01 -04:00
benebsiny
64415df08d fix the trimming of log filenames for gh run view 2024-08-18 16:57:19 +08:00
EBIBO
08aafc5484
Update pkg/cmd/issue/develop/develop.go
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-08-18 09:25:39 +08:00
benebsiny
e269d43c5a add testing 2024-08-17 13:47:02 +08:00
benebsiny
216c283e03 Merge branch 'trunk' into cli-9496 2024-08-17 12:05:17 +08:00
benebsiny
56e1cdae9e fix behavior for issue develop -b non-exist-branch 2024-08-17 12:04:09 +08:00
Arun
800f99d9fa Describe bucket and state JSON fields in pr checks command
While the `state` field corresponds 1:1 with different GitHub Actions
states, the `bucket` field is an abstraction of the CLI that lacked
documentation. This both adds documentation about the existence of the
`bucket` field and enumerates the possible values.
2024-08-16 15:26:27 -07:00
Prabhat Kumar Sahu
1886fb46ab
Fix pr checks exit code (#9452)
* Enhance  with exit code documentation

* Add new error message for PR check

* Refine gh pr checks: Add exit code 8

* Update EXIT CODES section format in man page generation
2024-08-16 14:30:11 -07:00
Heath Stewart
81f3526740
Fix tests 2024-08-16 10:11:52 -07:00
Fredrik Skogman
255f5301d5
Merge pull request #9467 from cli/attestation-tuf-root-update
Update attestation TUF root
2024-08-16 08:40:55 +02:00
Eugene
04e111db03
Merge branch 'trunk' into eugene/attestation/fetch-oci-bundle 2024-08-15 13:31:41 -04:00
Cody Soyland
4618a267de
Update attestation TUF root
Signed-off-by: Cody Soyland <codysoyland@github.com>
2024-08-15 13:06:54 -04:00
ejahnGithub
05891965d0 udpate the options 2024-08-15 11:56:28 -04:00
Kynan Ware
5b7070f027
include required permissions to generate attestations 2024-08-14 15:16:45 -06:00
Kynan Ware
820f4f3469
Do not generate build attestations for otherBinWorkflow.yml 2024-08-14 12:02:11 -06:00
bagtoad
025dcc8e95 Use latest checkout version, generate attestations, and specify go version file input. 2024-08-14 10:20:41 -06:00
Cody Soyland
9e27af999e
Merge pull request #9442 from cli/require-sigstore-bundle-v0.3
Require Sigstore Bundle v0.2+ when verifying with `gh attestation`
2024-08-13 13:56:11 -04:00
Tyler McGoffin
c838da9ee1 Update gh search issues --project flag doc to specify owner/number syntax
There are no code changes required to make this work. I added a test
specifying `<owner>/<number>` and nothing failed. Any syntax issues are
returned by the api with a generic message:

```
Invalid search query "project:\"<string>\" type:issue".
An invalid project was specified.
```

This, combined with the updated docstring, should be sufficient for users
to troubleshoot any issues with the `--project` flag syntax
2024-08-12 14:51:27 -07:00
Tyler McGoffin
e5248b8fd4 Update gh search prs --project flag doc to specify owner/number syntax
There are no code changes required to make this work. I added a test
specifying `<owner>/<number>` and nothing failed. Any syntax issues are
returned by the api with a generic message:

```
Invalid search query "project:\"<string>\" type:pr".
An invalid project was specified.
```

This, combined with the updated docstring, should be sufficient for users
to troubleshoot any issues with the `--project` flag syntax
2024-08-12 14:51:03 -07:00
Eugene
7539f2aea4
Merge branch 'trunk' into eugene/attestation/fetch-oci-bundle 2024-08-12 07:10:56 -07:00
ejahnGithub
5ae03d6e87 addded more test 2024-08-12 07:10:19 -07:00
Andy Feller
a863dfdb30
Merge pull request #9433 from benebsiny/cli-9310
Add `pr create --editor`
2024-08-12 10:10:18 -04:00
Andy Feller
369a105c45 Minor grammatical fix 2024-08-12 10:00:37 -04:00
Babak K. Shandiz
6dc729792d
Merge branch 'trunk' into 9299-improve-annotated-releases
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-08-10 21:55:41 +01:00
Babak K. Shandiz
668dbcefc6
Add test cases for PGP, SSH and X.509 signatures
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-08-10 21:50:31 +01:00
Babak K. Shandiz
b36b39df60
Explain why not looking for signature begin marker
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-08-10 21:29:22 +01:00
Yukai Chou
ac77d6750d Wrap flags with backticks, continued 2024-08-10 10:24:28 +08:00
Tyler McGoffin
18d58b8d84
Replace --project.* flags' name with title in docs (#9443)
With the upcoming migration from v1 project to v2 projects, we'd like the
language in our documentation to align with v2 project language. In v2,
projects are referred to by `title` and not `name`, though they are
functionally equivalent under the hood for the CLI
2024-08-09 13:55:14 -07:00
Cody Soyland
35b2cf70cf
Change to requiring bundle v0.2
Signed-off-by: Cody Soyland <codysoyland@github.com>
2024-08-09 16:36:16 -04:00
Cody Soyland
b783441540
Fix tests
Signed-off-by: Cody Soyland <codysoyland@github.com>
2024-08-09 16:14:04 -04:00
Cody Soyland
574e131072
Require Sigstore Bundle v0.3 when verifying with gh attestation
Signed-off-by: Cody Soyland <codysoyland@github.com>
2024-08-09 16:02:04 -04:00
Andy Feller
dbcac5abc4
Merge pull request #9412 from sato11/docs-run-download-n
Document that `gh run download` downloads the latest artifact by default
2024-08-08 17:33:06 -04:00
Prabhat Kumar Sahu
ab34d868aa
Change gh repo set-default --view to print to stderr when no default exists (#9431)
Change logging of `gh repo set-default --view` to `stderr` when no default exists to better conform with expectations and unix standards.

---------

Signed-off-by: Prabhat <iprabhatdev@gmail.com>
2024-08-08 13:44:52 -07:00
Junichi Sato
330a385f9e
Document that gh run download downloads the latest artifact by default
This commit addresses the documentation issue.

The discussion at #7018 has confirmed that it is undocumented that
the current behavior of `gh run download` with `-n` and no `run-id`
downloads the latest artifact.

Although the behavior has not been created intentionally, it is the one
that should be documented and the future releases should warn before
a breaking change.
2024-08-08 19:35:16 +09:00
benebsiny
e18c002283 Deduplicate the initialization of editor mode 2024-08-08 18:07:52 +08:00