Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub env file support #426

Merged
merged 12 commits into from
Jan 12, 2021
8 changes: 4 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker://golangci/golangci-lint:v1.23.8
with:
args: golangci-lint run
- uses: golangci/golangci-lint-action@v2
env:
CGO_ENABLED: 0
with:
version: v1.32.2

test:
name: Test
Expand All @@ -35,7 +35,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: GoReleaser
uses: goreleaser/goreleaser-action@v1
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --snapshot --rm-dist
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-expressions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
KEY_WITH_UNDERSCORES: value_with_underscores
SOMETHING_TRUE: true
SOMETHING_FALSE: false
ACT: true


jobs:
Expand Down
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
run:
timeout: 3m

linters-settings:
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 15
mi-complexity: 15
gocritic:
disabled-checks:
- ifElseChain
Expand Down
17 changes: 11 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/nektos/act/pkg/common"

fswatch "github.com/andreaskoch/go-fswatch"
"github.com/andreaskoch/go-fswatch"
"github.com/joho/godotenv"
"github.com/nektos/act/pkg/model"
"github.com/nektos/act/pkg/runner"
Expand Down Expand Up @@ -78,7 +78,12 @@ func readArgsFile(file string) []string {
if err != nil {
return args
}
defer f.Close()
defer func() {
err := f.Close()
if err != nil {
log.Errorf("Failed to close args file: %v", err)
}
}()
scanner := bufio.NewScanner(f)
for scanner.Scan() {
arg := scanner.Text()
Expand All @@ -90,7 +95,7 @@ func readArgsFile(file string) []string {

}

func setupLogging(cmd *cobra.Command, args []string) {
func setupLogging(cmd *cobra.Command, _ []string) {
verbose, _ := cmd.Flags().GetBool("verbose")
if verbose {
log.SetLevel(log.DebugLevel)
Expand Down Expand Up @@ -187,7 +192,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
Platforms: input.newPlatforms(),
Privileged: input.privileged,
}
runner, err := runner.New(config)
r, err := runner.New(config)
if err != nil {
return err
}
Expand All @@ -196,10 +201,10 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
if watch, err := cmd.Flags().GetBool("watch"); err != nil {
return err
} else if watch {
return watchAndRun(ctx, runner.NewPlanExecutor(plan))
return watchAndRun(ctx, r.NewPlanExecutor(plan))
}

return runner.NewPlanExecutor(plan)(ctx)
return r.NewPlanExecutor(plan)(ctx)
}
}

Expand Down
51 changes: 24 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,47 @@ go 1.14
require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/MichaelTJones/walk v0.0.0-20161122175330-4748e29d5718 // indirect
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/Microsoft/hcsshim v0.8.6 // indirect
github.com/Microsoft/go-winio v0.4.15 // indirect
github.com/Microsoft/hcsshim v0.8.10 // indirect
github.com/andreaskoch/go-fswatch v1.0.0
github.com/containerd/containerd v1.3.3 // indirect
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect
github.com/docker/cli v0.0.0-20200617172703-0ed913b885c8
github.com/containerd/containerd v1.4.1 // indirect
github.com/containerd/continuity v0.0.0-20200928162600-f2cc35102c2a // indirect
github.com/docker/cli v20.10.0-rc1+incompatible
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/go-git/go-billy/v5 v5.0.0
github.com/go-git/go-git/v5 v5.1.0
github.com/go-ini/ini v1.41.0
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/protobuf v1.3.1 // indirect
github.com/go-git/go-git/v5 v5.2.0
github.com/go-ini/ini v1.62.0
github.com/golang/protobuf v1.4.3 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/gorilla/mux v1.7.0 // indirect
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/joho/godotenv v1.3.0
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/mgutz/str v1.2.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v0.1.1
github.com/pkg/errors v0.8.1
github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff
github.com/opencontainers/runc v0.1.1 // indirect
github.com/pkg/errors v0.9.1
github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac
github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94
github.com/sirupsen/logrus v1.4.1
github.com/sirupsen/logrus v1.7.0
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.4.0
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c // indirect
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb // indirect
google.golang.org/grpc v1.20.1 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 // indirect
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 // indirect
google.golang.org/grpc v1.33.2 // indirect
gopkg.in/godo.v2 v2.0.9
gopkg.in/ini.v1 v1.41.0 // indirect
gopkg.in/sourcemap.v1 v1.0.5 // indirect
gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71
gotest.tools v2.2.0+incompatible // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
gotest.tools/v3 v3.0.2
)

Expand Down
Loading