Skip to content

Commit b0f58d0

Browse files
committed
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.
1 parent 1c103e2 commit b0f58d0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/cmd/actions/actions.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package actions
22

33
import (
4+
"fmt"
5+
46
"github.com/MakeNowJust/heredoc"
57
"github.com/cli/cli/pkg/cmdutil"
68
"github.com/cli/cli/pkg/iostreams"
@@ -14,11 +16,16 @@ func NewCmdActions(f *cmdutil.Factory) *cobra.Command {
1416
Use: "actions",
1517
Short: "Learn about working with GitHub actions",
1618
Long: actionsExplainer(cs),
19+
Run: func(cmd *cobra.Command, args []string) {
20+
fmt.Fprintln(f.IOStreams.Out, actionsExplainer(cs))
21+
},
1722
Annotations: map[string]string{
1823
"IsActions": "true",
1924
},
2025
}
2126

27+
cmdutil.DisableAuthCheck(cmd)
28+
2229
return cmd
2330
}
2431

0 commit comments

Comments
 (0)