From c7dd9edd57c6183fa89510cdafc738fd497acdca Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Wed, 29 Jan 2025 16:39:56 +0500 Subject: [PATCH 01/16] [gh workflow run] Improve error handling for `--ref` flag --- pkg/cmd/workflow/run/run.go | 14 +++++++++----- pkg/cmd/workflow/shared/shared.go | 5 ++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pkg/cmd/workflow/run/run.go b/pkg/cmd/workflow/run/run.go index b7ab53098..3ba64ad4a 100644 --- a/pkg/cmd/workflow/run/run.go +++ b/pkg/cmd/workflow/run/run.go @@ -262,11 +262,15 @@ func runRun(opts *RunOptions) error { ref := opts.Ref - if ref == "" { - ref, err = api.RepoDefaultBranch(client, repo) - if err != nil { - return fmt.Errorf("unable to determine default branch for %s: %w", ghrepo.FullName(repo), err) - } + defaultBranch, err := api.RepoDefaultBranch(client, repo) + if err != nil { + return fmt.Errorf("unable to determine default branch for %s: %w", ghrepo.FullName(repo), err) + } + + if ref != "" && ref != defaultBranch { + return fmt.Errorf("ref %s is not the default branch, and workflows must be on the default branch to be triggered by workflow_dispatch", ref) + } else { + ref = defaultBranch } states := []shared.WorkflowState{shared.Active} diff --git a/pkg/cmd/workflow/shared/shared.go b/pkg/cmd/workflow/shared/shared.go index db6b3ab12..61511ed7d 100644 --- a/pkg/cmd/workflow/shared/shared.go +++ b/pkg/cmd/workflow/shared/shared.go @@ -131,7 +131,10 @@ func FindWorkflow(client *api.Client, repo ghrepo.Interface, workflowSelector st if _, err := strconv.Atoi(workflowSelector); err == nil || isWorkflowFile(workflowSelector) { workflow, err := getWorkflowByID(client, repo, workflowSelector) if err != nil { - return nil, err + var httpErr api.HTTPError + if errors.As(err, &httpErr) && httpErr.StatusCode == 404 { + return nil, fmt.Errorf("workflow %s not found on the default branch", workflowSelector) + } } return []Workflow{*workflow}, nil } From abe6d8dd306b947eaa7421b3fa154a85cdc2ded4 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Fri, 31 Jan 2025 13:18:46 +0500 Subject: [PATCH 02/16] [docs/releasing.md] Add basic info for homebrew update flow --- docs/releasing.md | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/releasing.md b/docs/releasing.md index 4b977efdd..f1b87a9a7 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,15 +1,20 @@ # Releasing To initiate a new production deployment: + ```sh script/release vX.Y.Z ``` + See `script/release --help` for more information. -> **Note:** -> Every production release will request an approval by the select few people before it can proceed. +> [!NOTE] +> +> Every production release will request an approval by the select few people +> before it can proceed. What this does is: + - Builds Linux binaries on Ubuntu; - Builds and signs Windows binaries on Windows; - Builds, signs, and notarizes macOS binaries on macOS; @@ -18,22 +23,31 @@ What this does is: - The changelog is [generated from the list of merged pull requests](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes); - Updates cli.github.com with the contents of the new release; - Updates the [`gh` Homebrew formula](https://github.com/williammartin/homebrew-core/blob/master/Formula/g/gh.rb) in the [`homebrew/homebrew-core` repo](https://github.com/search?q=repo%3AHomebrew%2Fhomebrew-core+%22gh%22+in%3Atitle&type=pullrequests). + - The [GitHub CLI deployment workflow](.github/workflows/deployment.yml) + initiates a PR to update the `gh` Homebrew formula. + - This updated formula is then picked up by the scheduled workflow for its + inclusion in the `homebrew/homebrew-core`. To test out the build system while avoiding creating an actual release: + ```sh script/release --staging vX.Y.Z --branch patch-1 -p macos ``` + The build artifacts will be available via `gh run download -n macos`. ## General guidelines -* Features to be released should be reviewed and approved at least one day prior to the release. -* Feature releases should bump up the minor version number. -* Breaking releases should bump up the major version number. These should generally be rare. +- Features to be released should be reviewed and approved at least one day prior + to the release. +- Feature releases should bump up the minor version number. +- Breaking releases should bump up the major version number. These should + generally be rare. ## Test the build system locally -A local release can be created for testing without creating anything official on the release page. +A local release can be created for testing without creating anything official on +the release page. 1. Make sure GoReleaser is installed: `brew install goreleaser` 2. `script/release --local` @@ -45,5 +59,6 @@ Occasionally, it might be necessary to clean up a bad release and re-release. 1. Delete the release and associated tag 2. Re-release and monitor the workflow run logs -3. Open pull request updating [`gh` Homebrew formula](https://github.com/williammartin/homebrew-core/blob/master/Formula/g/gh.rb) with new SHA versions, linking the previous PR +3. Open pull request updating [`gh` Homebrew formula](https://github.com/williammartin/homebrew-core/blob/master/Formula/g/gh.rb) + with new SHA versions, linking the previous PR 4. Verify resulting Debian and RPM packages, Homebrew formula From 800a645e0e69ad026f03abacb7e724bb5a6b0857 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 4 Feb 2025 18:16:13 +0500 Subject: [PATCH 03/16] [gh config] Escape pipe symbol in Long desc for website manual --- internal/docs/markdown.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/docs/markdown.go b/internal/docs/markdown.go index 7ae8c6862..b7018c640 100644 --- a/internal/docs/markdown.go +++ b/internal/docs/markdown.go @@ -142,7 +142,8 @@ func genMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) fmt.Fprintf(w, "```\n%s\n```\n\n", cmd.UseLine()) } if hasLong { - fmt.Fprintf(w, "%s\n\n", cmd.Long) + longWithEscapedPipe := strings.ReplaceAll(cmd.Long, "|", "\\|") + fmt.Fprintf(w, "%s\n\n", longWithEscapedPipe) } for _, g := range root.GroupedCommands(cmd) { From a4b86bff777791b0c07bddbde80beb5994a7f88d Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 4 Feb 2025 18:48:56 +0500 Subject: [PATCH 04/16] Use HTML numeric code instead of escaping with slash --- internal/docs/markdown.go | 2 +- pkg/cmd/config/config.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/docs/markdown.go b/internal/docs/markdown.go index b7018c640..05d8686b8 100644 --- a/internal/docs/markdown.go +++ b/internal/docs/markdown.go @@ -142,7 +142,7 @@ func genMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) fmt.Fprintf(w, "```\n%s\n```\n\n", cmd.UseLine()) } if hasLong { - longWithEscapedPipe := strings.ReplaceAll(cmd.Long, "|", "\\|") + longWithEscapedPipe := strings.ReplaceAll(cmd.Long, "|", "|") fmt.Fprintf(w, "%s\n\n", longWithEscapedPipe) } diff --git a/pkg/cmd/config/config.go b/pkg/cmd/config/config.go index 2661c3369..66051f83a 100644 --- a/pkg/cmd/config/config.go +++ b/pkg/cmd/config/config.go @@ -16,7 +16,7 @@ import ( func NewCmdConfig(f *cmdutil.Factory) *cobra.Command { longDoc := strings.Builder{} longDoc.WriteString("Display or change configuration settings for gh.\n\n") - longDoc.WriteString("Current respected settings:\n") + longDoc.WriteString("Current respected settings:\n\n") for _, co := range config.Options { longDoc.WriteString(fmt.Sprintf("- `%s`: %s", co.Key, co.Description)) if len(co.AllowedValues) > 0 { From b95e6b2ae4a4bedcd10c4aa380bb7e4ccc5df248 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Wed, 5 Feb 2025 11:22:54 +0500 Subject: [PATCH 05/16] Revert breaking change --- pkg/cmd/workflow/run/run.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/workflow/run/run.go b/pkg/cmd/workflow/run/run.go index 3ba64ad4a..b7ab53098 100644 --- a/pkg/cmd/workflow/run/run.go +++ b/pkg/cmd/workflow/run/run.go @@ -262,15 +262,11 @@ func runRun(opts *RunOptions) error { ref := opts.Ref - defaultBranch, err := api.RepoDefaultBranch(client, repo) - if err != nil { - return fmt.Errorf("unable to determine default branch for %s: %w", ghrepo.FullName(repo), err) - } - - if ref != "" && ref != defaultBranch { - return fmt.Errorf("ref %s is not the default branch, and workflows must be on the default branch to be triggered by workflow_dispatch", ref) - } else { - ref = defaultBranch + if ref == "" { + ref, err = api.RepoDefaultBranch(client, repo) + if err != nil { + return fmt.Errorf("unable to determine default branch for %s: %w", ghrepo.FullName(repo), err) + } } states := []shared.WorkflowState{shared.Active} From 64b63f61f667639167e89082541f23c11fca5061 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Wed, 5 Feb 2025 16:30:57 +0500 Subject: [PATCH 06/16] [gh project item-edit] Fix number type --- pkg/cmd/project/item-edit/item_edit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/project/item-edit/item_edit.go b/pkg/cmd/project/item-edit/item_edit.go index 63dcb3b39..657af1f54 100644 --- a/pkg/cmd/project/item-edit/item_edit.go +++ b/pkg/cmd/project/item-edit/item_edit.go @@ -23,7 +23,7 @@ type editItemOpts struct { fieldID string projectID string text string - number float32 + number float64 date string singleSelectOptionID string iterationID string @@ -123,7 +123,7 @@ func NewCmdEditItem(f *cmdutil.Factory, runF func(config editItemConfig) error) editItemCmd.Flags().StringVar(&opts.fieldID, "field-id", "", "ID of the field to update") editItemCmd.Flags().StringVar(&opts.projectID, "project-id", "", "ID of the project to which the field belongs to") editItemCmd.Flags().StringVar(&opts.text, "text", "", "Text value for the field") - editItemCmd.Flags().Float32Var(&opts.number, "number", 0, "Number value for the field") + editItemCmd.Flags().Float64Var(&opts.number, "number", 0, "Number value for the field") editItemCmd.Flags().StringVar(&opts.date, "date", "", "Date value for the field (YYYY-MM-DD)") editItemCmd.Flags().StringVar(&opts.singleSelectOptionID, "single-select-option-id", "", "ID of the single select option value to set on the field") editItemCmd.Flags().StringVar(&opts.iterationID, "iteration-id", "", "ID of the iteration value to set on the field") From 277f27442ce678d578a04b3feab72aa5265a78a6 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Wed, 5 Feb 2025 19:51:52 +0500 Subject: [PATCH 07/16] Update tests --- pkg/cmd/project/item-edit/item_edit_test.go | 12 ++++++++++-- pkg/cmd/project/shared/queries/queries.go | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/project/item-edit/item_edit_test.go b/pkg/cmd/project/item-edit/item_edit_test.go index fb9097d19..2f9a16df6 100644 --- a/pkg/cmd/project/item-edit/item_edit_test.go +++ b/pkg/cmd/project/item-edit/item_edit_test.go @@ -47,6 +47,14 @@ func TestNewCmdeditItem(t *testing.T) { itemID: "123", }, }, + { + name: "number with floating point value", + cli: "--number 123.45 --id 123", + wants: editItemOpts{ + number: 123.45, + itemID: "123", + }, + }, { name: "field-id", cli: "--field-id FIELD_ID --id 123", @@ -255,7 +263,7 @@ func TestRunItemEdit_Number(t *testing.T) { // edit item gock.New("https://api.github.com"). Post("/graphql"). - BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"number":2}}}}`). + BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"number":123.45}}}}`). Reply(200). JSON(map[string]interface{}{ "data": map[string]interface{}{ @@ -284,7 +292,7 @@ func TestRunItemEdit_Number(t *testing.T) { config := editItemConfig{ io: ios, opts: editItemOpts{ - number: 2, + number: 123.45, itemID: "item_id", projectID: "project_id", fieldID: "field_id", diff --git a/pkg/cmd/project/shared/queries/queries.go b/pkg/cmd/project/shared/queries/queries.go index 5855e906e..3e63465dd 100644 --- a/pkg/cmd/project/shared/queries/queries.go +++ b/pkg/cmd/project/shared/queries/queries.go @@ -250,7 +250,7 @@ type FieldValueNodes struct { Field ProjectField } `graphql:"... on ProjectV2ItemFieldLabelValue"` ProjectV2ItemFieldNumberValue struct { - Number float32 + Number float64 Field ProjectField } `graphql:"... on ProjectV2ItemFieldNumberValue"` ProjectV2ItemFieldSingleSelectValue struct { From 3e03f5d106b9f0e99de2c606d9b71f97ad86c556 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:17:31 +0000 Subject: [PATCH 08/16] Bump google.golang.org/protobuf from 1.36.4 to 1.36.5 Bumps google.golang.org/protobuf from 1.36.4 to 1.36.5. --- updated-dependencies: - dependency-name: google.golang.org/protobuf dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 38837b883..4e88a54d5 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( golang.org/x/term v0.28.0 golang.org/x/text v0.21.0 google.golang.org/grpc v1.69.4 - google.golang.org/protobuf v1.36.4 + google.golang.org/protobuf v1.36.5 gopkg.in/h2non/gock.v1 v1.1.2 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 883ac72ce..d58e8de5b 100644 --- a/go.sum +++ b/go.sum @@ -559,8 +559,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4= google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= -google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= -google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= +google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From 60e028505d8a492c39f72d265cf241774ce31f6b Mon Sep 17 00:00:00 2001 From: Kynan Ware <47394200+BagToad@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:04:04 -0700 Subject: [PATCH 09/16] Doc: Clarify guidelines for `help wanted` issues and prs --- .github/CONTRIBUTING.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9a0acb58e..01772092d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -4,23 +4,25 @@ Hi! Thanks for your interest in contributing to the GitHub CLI! We accept pull requests for bug fixes and features where we've discussed the approach in an issue and given the go-ahead for a community member to work on it. We'd also love to hear about ideas for new features as issues. -Please do: +### Please do: -* Check issues to verify that a [bug][bug issues] or [feature request][feature request issues] issue does not already exist for the same problem or feature. -* Open an issue if things aren't working as expected. -* Open an issue to propose a significant change. -* Open an issue to propose a design for an issue labelled [`needs-design` and `help wanted`][needs design and help wanted], following the [proposing a design guidelines](#proposing-a-design) instructions below. -* Open a pull request to fix a bug. -* Open a pull request to fix documentation about a command. -* Open a pull request for any issue labelled [`help wanted`][hw] or [`good first issue`][gfi]. +* Check issues to verify that a [bug][bug issues] or [feature request][feature request issues] issue does not already exist for the same problem or feature +* Open an issue if things aren't working as expected +* Open an issue to propose a significant change +* Open an issue to propose a design for an issue labelled [`needs-design` and `help wanted`][needs design and help wanted], following the [proposing a design guidelines](#proposing-a-design) instructions below +* Mention `@cli/code-reviewers` when an issue you want to work on does not have clear Acceptance Criteria +* Open a pull request to fix a bug +* Open a pull request to fix documentation about a command +* Open a pull request for any issue labelled [`help wanted`][hw] or [`good first issue`][gfi] -Please avoid: +### Please _do not_: -* Opening pull requests for issues marked `needs-design`, `needs-investigation`, or `blocked`. -* Opening pull requests that haven't been approved for work in an issue -* Adding installation instructions specifically for your OS/package manager. -* Opening pull requests for any issue marked `core`. These issues require additional context from - the core CLI team at GitHub and any external pull requests will not be accepted. +* Open pull requests for issues marked `needs-design`, `needs-investigation`, or `blocked` +* Open pull requests that haven't been approved for work in an issue +* Expand pull request scope to include changes that are not described in the issue's Acceptance Criteria +* Add installation instructions specifically for your OS/package manager +* Open pull requests for any issue marked `core`. These issues require additional context from + the core CLI team at GitHub and any external pull requests will not be accepted ## Building the project From 4cf0901b87eb6ad189d6d4eb9d4947295cf57feb Mon Sep 17 00:00:00 2001 From: Andy Feller Date: Thu, 6 Feb 2025 18:12:42 -0500 Subject: [PATCH 10/16] Update release doc content - simplifying certain language - updating content around scheduled formula workflow process that makes new versions available --- docs/releasing.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/releasing.md b/docs/releasing.md index f1b87a9a7..5e3e48a98 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -9,9 +9,7 @@ script/release vX.Y.Z See `script/release --help` for more information. > [!NOTE] -> -> Every production release will request an approval by the select few people -> before it can proceed. +> Deployment workflow requires maintainer approval to run. What this does is: @@ -21,12 +19,13 @@ What this does is: - Uploads all release artifacts to a new GitHub Release; - A new git tag `vX.Y.Z` is created in the remote repository; - The changelog is [generated from the list of merged pull requests](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes); -- Updates cli.github.com with the contents of the new release; +- Updates [GitHub CLI marketing site](https://cli.github.com) with the contents of the new release; - Updates the [`gh` Homebrew formula](https://github.com/williammartin/homebrew-core/blob/master/Formula/g/gh.rb) in the [`homebrew/homebrew-core` repo](https://github.com/search?q=repo%3AHomebrew%2Fhomebrew-core+%22gh%22+in%3Atitle&type=pullrequests). - - The [GitHub CLI deployment workflow](.github/workflows/deployment.yml) - initiates a PR to update the `gh` Homebrew formula. - - This updated formula is then picked up by the scheduled workflow for its - inclusion in the `homebrew/homebrew-core`. + +> [!NOTE] +> `Homebrew/formulae.brew.sh` makes new formula versions available every 15 minutes through scheduled [CI workflow](https://github.com/Homebrew/formulae.brew.sh/actions/workflows/tests.yml). +> +> For more information, see https://docs.brew.sh/Formula-Cookbook#an-introduction To test out the build system while avoiding creating an actual release: From 22bac00148393308716a90271f7fe9653b3b852f Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Fri, 7 Feb 2025 21:13:17 +0500 Subject: [PATCH 11/16] [gh pr status] Mention `gh pr checks` in the `Long` section --- pkg/cmd/pr/status/status.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/pr/status/status.go b/pkg/cmd/pr/status/status.go index 2436934bf..b8d506593 100644 --- a/pkg/cmd/pr/status/status.go +++ b/pkg/cmd/pr/status/status.go @@ -9,6 +9,7 @@ import ( "strconv" "time" + "github.com/MakeNowJust/heredoc" "github.com/cli/cli/v2/api" ghContext "github.com/cli/cli/v2/context" "github.com/cli/cli/v2/git" @@ -51,7 +52,15 @@ func NewCmdStatus(f *cmdutil.Factory, runF func(*StatusOptions) error) *cobra.Co cmd := &cobra.Command{ Use: "status", Short: "Show status of relevant pull requests", - Args: cmdutil.NoArgsQuoteReminder, + Long: heredoc.Docf(` + Show status of relevant pull requests. + + The status shows a summary of PRs that includes information such as + PR number, title, CI checks, reviews, etc. + + For the details of CI checks, run %[1]sgh pr checks%[1]s. + `, "`"), + Args: cmdutil.NoArgsQuoteReminder, RunE: func(cmd *cobra.Command, args []string) error { // support `-R, --repo` override opts.BaseRepo = f.BaseRepo From b2eec1cd5fd665514abf21ff77c95dc2621cf151 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Fri, 7 Feb 2025 21:15:19 +0500 Subject: [PATCH 12/16] Update language --- pkg/cmd/pr/status/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/pr/status/status.go b/pkg/cmd/pr/status/status.go index b8d506593..3c02eb7b9 100644 --- a/pkg/cmd/pr/status/status.go +++ b/pkg/cmd/pr/status/status.go @@ -58,7 +58,7 @@ func NewCmdStatus(f *cmdutil.Factory, runF func(*StatusOptions) error) *cobra.Co The status shows a summary of PRs that includes information such as PR number, title, CI checks, reviews, etc. - For the details of CI checks, run %[1]sgh pr checks%[1]s. + To see more details of CI checks, run %[1]sgh pr checks%[1]s. `, "`"), Args: cmdutil.NoArgsQuoteReminder, RunE: func(cmd *cobra.Command, args []string) error { From 5c6540bf59ba5d61f7fc0646e1ac6c4a0e69fd09 Mon Sep 17 00:00:00 2001 From: Kynan Ware <47394200+BagToad@users.noreply.github.com> Date: Fri, 7 Feb 2025 09:54:40 -0700 Subject: [PATCH 13/16] Remove redundant instructions --- .github/CONTRIBUTING.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 01772092d..f819793f0 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -11,8 +11,6 @@ We accept pull requests for bug fixes and features where we've discussed the app * Open an issue to propose a significant change * Open an issue to propose a design for an issue labelled [`needs-design` and `help wanted`][needs design and help wanted], following the [proposing a design guidelines](#proposing-a-design) instructions below * Mention `@cli/code-reviewers` when an issue you want to work on does not have clear Acceptance Criteria -* Open a pull request to fix a bug -* Open a pull request to fix documentation about a command * Open a pull request for any issue labelled [`help wanted`][hw] or [`good first issue`][gfi] ### Please _do not_: From fa39aa7e5e0ab18c5eff8ee8103b40b5c9f40ef9 Mon Sep 17 00:00:00 2001 From: Kynan Ware <47394200+BagToad@users.noreply.github.com> Date: Fri, 7 Feb 2025 09:56:14 -0700 Subject: [PATCH 14/16] Collapse related instructions --- .github/CONTRIBUTING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f819793f0..5bb8e43db 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -15,8 +15,7 @@ We accept pull requests for bug fixes and features where we've discussed the app ### Please _do not_: -* Open pull requests for issues marked `needs-design`, `needs-investigation`, or `blocked` -* Open pull requests that haven't been approved for work in an issue +* Open a pull request for issues without the `help wanted` label or explicit Acceptance Criteria * Expand pull request scope to include changes that are not described in the issue's Acceptance Criteria * Add installation instructions specifically for your OS/package manager * Open pull requests for any issue marked `core`. These issues require additional context from From c8a1f8c699289bb43249eee907fcb7c5ef8601bd Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Fri, 7 Feb 2025 22:56:00 +0500 Subject: [PATCH 15/16] Update pkg/cmd/pr/status/status.go Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com> --- pkg/cmd/pr/status/status.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/pr/status/status.go b/pkg/cmd/pr/status/status.go index 3c02eb7b9..b7b390bf2 100644 --- a/pkg/cmd/pr/status/status.go +++ b/pkg/cmd/pr/status/status.go @@ -55,8 +55,8 @@ func NewCmdStatus(f *cmdutil.Factory, runF func(*StatusOptions) error) *cobra.Co Long: heredoc.Docf(` Show status of relevant pull requests. - The status shows a summary of PRs that includes information such as - PR number, title, CI checks, reviews, etc. + The status shows a summary of pull requests that includes information such as + pull request number, title, CI checks, reviews, etc. To see more details of CI checks, run %[1]sgh pr checks%[1]s. `, "`"), From 023e3470780c2bafca6b08e6eaada56eb8f7ad77 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 7 Feb 2025 10:24:27 -0500 Subject: [PATCH 16/16] Do not try to parse bodies for HEAD requests Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- pkg/cmd/api/api.go | 8 +++++--- pkg/cmd/api/api_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/api/api.go b/pkg/cmd/api/api.go index a6eb69718..a1308d09f 100644 --- a/pkg/cmd/api/api.go +++ b/pkg/cmd/api/api.go @@ -463,9 +463,11 @@ func processResponse(resp *http.Response, opts *ApiOptions, bodyWriter, headersW var serverError string if isJSON && (opts.RequestPath == "graphql" || resp.StatusCode >= 400) { - responseBody, serverError, err = parseErrorResponse(responseBody, resp.StatusCode) - if err != nil { - return + if !strings.EqualFold(opts.RequestMethod, "HEAD") { + responseBody, serverError, err = parseErrorResponse(responseBody, resp.StatusCode) + if err != nil { + return + } } } diff --git a/pkg/cmd/api/api_test.go b/pkg/cmd/api/api_test.go index a565312cd..321f7b7c0 100644 --- a/pkg/cmd/api/api_test.go +++ b/pkg/cmd/api/api_test.go @@ -1234,6 +1234,35 @@ func Test_apiRun_DELETE(t *testing.T) { } } +func Test_apiRun_HEAD(t *testing.T) { + ios, _, _, _ := iostreams.Test() + + err := apiRun(&ApiOptions{ + IO: ios, + Config: func() (gh.Config, error) { + return config.NewBlankConfig(), nil + }, + HttpClient: func() (*http.Client, error) { + var tr roundTripper = func(req *http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: 422, + Request: req, + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }}, nil + } + return &http.Client{Transport: tr}, nil + }, + MagicFields: []string(nil), + RawFields: []string(nil), + RequestMethod: "HEAD", + RequestMethodPassed: true, + }) + if err != cmdutil.SilentError { + t.Fatalf("got error %v", err) + } +} + func Test_apiRun_inputFile(t *testing.T) { tests := []struct { name string