From b0f58d0cf05ecc9255568eb7550d6fd88c047f92 Mon Sep 17 00:00:00 2001 From: chemotaxis Date: Fri, 18 Jun 2021 23:17:41 -0400 Subject: [PATCH] Disable authentication check, but keep runnable In this branch, we originally avoided the authentication check by getting rid of the run method attached to the command. Instead of that, this commit makes the `gh actions` command runnable again, but the authentication is disabled with `cmdutil.DisableAuthCheck`; this mirrors what's done for `gh version`. `gh actions` and `gh actions [-h | --help]` all work while being logged out. In addition, this commit restores some original behavior. Before this commit, the help footer (usage, inherited flags, etc.) is appended whether you use `gh actions` or `gh actions --help`. This commit restores the original behavior where `gh actions` prints just the text for the actions explanation, but `gh actions --help` appends the help footer. --- pkg/cmd/actions/actions.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/cmd/actions/actions.go b/pkg/cmd/actions/actions.go index dd731d0ce..7880a9a6c 100644 --- a/pkg/cmd/actions/actions.go +++ b/pkg/cmd/actions/actions.go @@ -1,6 +1,8 @@ package actions import ( + "fmt" + "github.com/MakeNowJust/heredoc" "github.com/cli/cli/pkg/cmdutil" "github.com/cli/cli/pkg/iostreams" @@ -14,11 +16,16 @@ func NewCmdActions(f *cmdutil.Factory) *cobra.Command { Use: "actions", Short: "Learn about working with GitHub actions", Long: actionsExplainer(cs), + Run: func(cmd *cobra.Command, args []string) { + fmt.Fprintln(f.IOStreams.Out, actionsExplainer(cs)) + }, Annotations: map[string]string{ "IsActions": "true", }, } + cmdutil.DisableAuthCheck(cmd) + return cmd }