Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Commit

Permalink
Added some information output
Browse files Browse the repository at this point in the history
  • Loading branch information
StiviiK committed Apr 30, 2020
1 parent e75f183 commit 2b0207c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), inputs.Timeout)
setupInterruptHandler(cancel)

// Output some information
githubOptions := opts.GitHub
if githubOptions.RunningAsAction {
logrus.Infof("==== Running workflow %s for %s@%s ====", githubOptions.Workflow, githubOptions.Ref, githubOptions.Commit)
}

// deploy the template
resultDeployment, err := actions.Deploy(ctx, inputs)
if err != nil {
Expand All @@ -46,6 +52,9 @@ func main() {

// output the deploymentname
github.SetOutput("deploymentName", *resultDeployment.Name)
if githubOptions.RunningAsAction {
logrus.Info("==== Successfully finished running the workflow ====")
}
}

func setupInterruptHandler(cancel func()) {
Expand Down
17 changes: 9 additions & 8 deletions pkg/github/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ import (

// GitHub represents the inputs which github provides us on default
type GitHub struct {
Workflow string `env:"GITHUB_WORKFLOW"`
Action string `env:"GITHUB_ACTION"`
Actor string `env:"GITHUB_ACTOR"`
Repository string `env:"GITHUB_REPOSITORY"`
Commit string `env:"GITHUB_SHA"`
EventName string `env:"GITHUB_EVENT_NAME"`
EventPath string `env:"GITHUB_EVENT_PATH"`
Ref string `env:"GITHUB_REF"`
Workflow string `env:"GITHUB_WORKFLOW"`
Action string `env:"GITHUB_ACTION"`
Actor string `env:"GITHUB_ACTOR"`
Repository string `env:"GITHUB_REPOSITORY"`
Commit string `env:"GITHUB_SHA"`
EventName string `env:"GITHUB_EVENT_NAME"`
EventPath string `env:"GITHUB_EVENT_PATH"`
Ref string `env:"GITHUB_REF"`
RunningAsAction bool `env:"GITHUB_ACTIONS" envDefault:"false"`
}

// Inputs represents our custom inputs for the action
Expand Down

0 comments on commit 2b0207c

Please sign in to comment.