github.com/andrewhsu/cli/v2@v2.0.1-0.20210910131313-d4b4061f5b89/pkg/cmd/actions/actions.go (about)

     1  package actions
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/MakeNowJust/heredoc"
     7  	"github.com/andrewhsu/cli/v2/pkg/cmdutil"
     8  	"github.com/andrewhsu/cli/v2/pkg/iostreams"
     9  	"github.com/spf13/cobra"
    10  )
    11  
    12  func NewCmdActions(f *cmdutil.Factory) *cobra.Command {
    13  	cs := f.IOStreams.ColorScheme()
    14  
    15  	cmd := &cobra.Command{
    16  		Use:   "actions",
    17  		Short: "Learn about working with GitHub actions",
    18  		Long:  actionsExplainer(cs),
    19  		Run: func(cmd *cobra.Command, args []string) {
    20  			fmt.Fprintln(f.IOStreams.Out, actionsExplainer(cs))
    21  		},
    22  		Annotations: map[string]string{
    23  			"IsActions": "true",
    24  		},
    25  	}
    26  
    27  	cmdutil.DisableAuthCheck(cmd)
    28  
    29  	return cmd
    30  }
    31  
    32  func actionsExplainer(cs *iostreams.ColorScheme) string {
    33  	header := cs.Bold("Welcome to GitHub Actions on the command line.")
    34  	runHeader := cs.Bold("Interacting with workflow runs")
    35  	workflowHeader := cs.Bold("Interacting with workflow files")
    36  
    37  	return heredoc.Docf(`
    38  			%s
    39  
    40  			GitHub CLI integrates with Actions to help you manage runs and workflows.
    41  
    42  			%s  
    43  			gh run list:      List recent workflow runs  
    44  			gh run view:      View details for a workflow run or one of its jobs  
    45  			gh run watch:     Watch a workflow run while it executes  
    46  			gh run rerun:     Rerun a failed workflow run  
    47  			gh run download:  Download artifacts generated by runs
    48  
    49  			To see more help, run 'gh help run <subcommand>'
    50  
    51  			%s  
    52  			gh workflow list:     List all the workflow files in your repository  
    53  			gh workflow view:     View details for a workflow file  
    54  			gh workflow enable:   Enable a workflow file  
    55  			gh workflow disable:  Disable a workflow file  
    56  			gh workflow run:      Trigger a workflow_dispatch run for a workflow file
    57  
    58  			To see more help, run 'gh help workflow <subcommand>'
    59  		`, header, runHeader, workflowHeader)
    60  }