Add super-linter
+ fix lint issues (#650)
* feat: bump `golangci-lint`, add `super-linter`, replace outdated linter Bump `golangci-lint` version. Add `super-linter` to lint other languages. Go linter is disabled because it's currently broken: https://github.com/github/super-linter/pull/370 Replacing `scopelint` with `exportloopref`: "[runner] The linter 'scopelint' is deprecated (since v1.39.0) due to: The repository of the linter has been deprecated by the owner. Replaced by exportloopref." Fixed formatting in `.golangci.yml` Add addtional linters: `misspell`: purely style, detects typos in comments `whitespace`: detects leading and trailing whitespace `goimports`: it's gofmt + checks unused imports * fix: lint/fix `go` files * fix: lint with `standardjs` * fix: lint/fix with `markdownlint`, make template more verbose * feat: add lint stuff to makefile * fix: `UseGitIgnore` formatting * fix: lint/fix `README.md` Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
parent
3db3d416e3
commit
cec63488f3
24 changed files with 141 additions and 69 deletions
42
.github/ISSUE_TEMPLATE/issue_template.md
vendored
42
.github/ISSUE_TEMPLATE/issue_template.md
vendored
|
@ -1,20 +1,23 @@
|
||||||
---
|
---
|
||||||
name: Issue
|
name: Issue
|
||||||
about: Use this template for reporting a bug/issue.
|
about: Use this template for reporting a bug/issue.
|
||||||
title: "Issue: "
|
title: "Issue: <shortly describe issue>"
|
||||||
labels: kind/bug
|
labels: kind/bug
|
||||||
assignees: ''
|
assignees: ''
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
- Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases)
|
- Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases)
|
||||||
- Search the existing issues.
|
- Search the existing issues.
|
||||||
- Refer to [README](https://github.com/nektos/act/blob/master/README.md).
|
- Refer to [README](https://github.com/nektos/act/blob/master/README.md).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## Act version
|
## Act version
|
||||||
|
|
||||||
<!-- Paste output of `act --version` -->
|
<!--
|
||||||
|
- Paste output of `act --version` inside the code block below
|
||||||
|
- If you've built `act` yourself, please provide commit hash
|
||||||
|
-->
|
||||||
|
|
||||||
```none
|
```none
|
||||||
|
|
||||||
|
@ -22,14 +25,23 @@ assignees: ''
|
||||||
|
|
||||||
## Expected behaviour
|
## Expected behaviour
|
||||||
|
|
||||||
<!-- Describe how whole process should go and finish -->
|
<!--
|
||||||
|
- Describe how whole process should go and finish
|
||||||
|
-->
|
||||||
|
|
||||||
## Actual behaviour
|
## Actual behaviour
|
||||||
|
|
||||||
<!-- Describe what happened -->
|
<!--
|
||||||
|
- Describe the issue
|
||||||
|
-->
|
||||||
|
|
||||||
## Workflow and/or repository
|
## Workflow and/or repository
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- Provide workflow with which we can reproduce the issue
|
||||||
|
OR
|
||||||
|
- Provide link to your GitHub repository that contains the workflow
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>workflow</summary>
|
<summary>workflow</summary>
|
||||||
|
|
||||||
|
@ -47,23 +59,23 @@ jobs:
|
||||||
## Steps to reproduce
|
## Steps to reproduce
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Make sure to include command you used to run `act`
|
- Make sure to include full command with parameters you used to run `act`, example:
|
||||||
e.g.:
|
1. Clone example repo (https://github.com/cplee/github-actions-demo)
|
||||||
1. Clone example repo (https://github.com/cplee/github-actions-demo)
|
2. Enter cloned repo directory
|
||||||
2. Enter cloned repo directory
|
3. Run `act -s SUPER_SECRET=im-a-value`
|
||||||
3. Run `act -s SUPER_SECRET=im-a-value`
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
## `act` output
|
## `act` output
|
||||||
|
|
||||||
<!-- Paste output from your terminal, use `-v` or `--verbose` for richer output -->
|
<!--
|
||||||
|
- Use `act` with `-v`/`--verbose` and paste output from your terminal in code block below
|
||||||
|
-->
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Log</summary>
|
<summary>Log</summary>
|
||||||
|
|
||||||
```none
|
```none
|
||||||
|
PASTE YOUR LOG HERE
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
1
.github/linters/.golangci.yml
vendored
Symbolic link
1
.github/linters/.golangci.yml
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.golangci.yml
|
11
.github/linters/.markdown-lint.yml
vendored
Normal file
11
.github/linters/.markdown-lint.yml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Default state for all rules
|
||||||
|
default: true
|
||||||
|
|
||||||
|
# MD013/line-length - Line length
|
||||||
|
MD013: false
|
||||||
|
|
||||||
|
# MD033/no-inline-html - Inline HTML
|
||||||
|
MD033: false
|
||||||
|
|
||||||
|
# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
|
||||||
|
MD041: false
|
16
.github/workflows/push.yml
vendored
16
.github/workflows/push.yml
vendored
|
@ -7,6 +7,8 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
- uses: actions/setup-go@v1
|
- uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.16
|
go-version: 1.16
|
||||||
|
@ -14,7 +16,19 @@ jobs:
|
||||||
env:
|
env:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
with:
|
with:
|
||||||
version: v1.32.2
|
version: v1.39.0
|
||||||
|
- uses: github/super-linter@v3
|
||||||
|
env:
|
||||||
|
DEFAULT_BRANCH: master
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
FILTER_REGEX_EXCLUDE: .*testdata/*
|
||||||
|
VALIDATE_ALL_CODEBASE: ${{ github.event_name != 'pull_request' }} # lint only new changes when pull_request
|
||||||
|
VALIDATE_BASH: false
|
||||||
|
VALIDATE_DOCKERFILE: false
|
||||||
|
VALIDATE_DOCKERFILE_HADOLINT: false
|
||||||
|
VALIDATE_GO: false # it's broken, see commit message
|
||||||
|
VALIDATE_JSCPD: false
|
||||||
|
VALIDATE_SHELL_SHFMT: false
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test on Linux
|
name: Test on Linux
|
||||||
|
|
|
@ -20,5 +20,8 @@ linters:
|
||||||
- dupl
|
- dupl
|
||||||
- nakedret
|
- nakedret
|
||||||
- prealloc
|
- prealloc
|
||||||
- scopelint
|
- exportloopref
|
||||||
- gocritic
|
- gocritic
|
||||||
|
- goimports
|
||||||
|
- whitespace
|
||||||
|
- misspell
|
||||||
|
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"go.lintTool": "golangci-lint",
|
||||||
|
"go.lintFlags": [
|
||||||
|
"--fix"
|
||||||
|
]
|
||||||
|
}
|
|
@ -21,7 +21,7 @@ If you've identified a bug in `act`, please [submit an issue](#issue) to our Git
|
||||||
|
|
||||||
All feature requests should start with [submitting an issue](#issue) documenting the user story and acceptance criteria. Again, feel free to submit a [Pull Request](#pr) with a proposed implementation of the feature.
|
All feature requests should start with [submitting an issue](#issue) documenting the user story and acceptance criteria. Again, feel free to submit a [Pull Request](#pr) with a proposed implementation of the feature.
|
||||||
|
|
||||||
## <a name="process"></a> Ready to Contribute!
|
## <a name="process"></a> Ready to Contribute
|
||||||
|
|
||||||
### <a name="issue"></a> Create an issue
|
### <a name="issue"></a> Create an issue
|
||||||
|
|
||||||
|
|
47
Makefile
47
Makefile
|
@ -6,8 +6,17 @@ MINOR_VERSION = $(word 2, $(subst ., ,$(VERSION)))
|
||||||
PATCH_VERSION = $(word 3, $(subst ., ,$(word 1,$(subst -, , $(VERSION)))))
|
PATCH_VERSION = $(word 3, $(subst ., ,$(word 1,$(subst -, , $(VERSION)))))
|
||||||
NEW_VERSION ?= $(MAJOR_VERSION).$(MINOR_VERSION).$(shell echo $$(( $(PATCH_VERSION) + 1)) )
|
NEW_VERSION ?= $(MAJOR_VERSION).$(MINOR_VERSION).$(shell echo $$(( $(PATCH_VERSION) + 1)) )
|
||||||
|
|
||||||
|
fix = false
|
||||||
|
ifeq (true,$(fix))
|
||||||
|
FIX = --fix
|
||||||
|
endif
|
||||||
|
|
||||||
ACT ?= go run main.go
|
ACT ?= go run main.go
|
||||||
export GITHUB_TOKEN := $(shell cat ~/.config/github/token)
|
|
||||||
|
HAS_TOKEN = $(if $(test -e ~/.config/github/token),true,false)
|
||||||
|
ifeq (true,$(HAS_TOKEN))
|
||||||
|
export GITHUB_TOKEN := $(shell cat ~/.config/github/token)
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
|
@ -22,6 +31,42 @@ test:
|
||||||
go test ./...
|
go test ./...
|
||||||
$(ACT)
|
$(ACT)
|
||||||
|
|
||||||
|
.PHONY: lint-go
|
||||||
|
lint-go:
|
||||||
|
golangci-lint run $(FIX)
|
||||||
|
|
||||||
|
.PHONY: lint-js
|
||||||
|
lint-js:
|
||||||
|
standard $(FIX)
|
||||||
|
|
||||||
|
.PHONY: lint-md
|
||||||
|
lint-md:
|
||||||
|
markdownlint . $(FIX)
|
||||||
|
|
||||||
|
.PHONY: lint-rest
|
||||||
|
lint-rest:
|
||||||
|
docker run --rm -it \
|
||||||
|
-e 'RUN_LOCAL=true' \
|
||||||
|
-e 'FILTER_REGEX_EXCLUDE=.*testdata/*' \
|
||||||
|
-e 'VALIDATE_BASH=false' \
|
||||||
|
-e 'VALIDATE_DOCKERFILE=false' \
|
||||||
|
-e 'VALIDATE_DOCKERFILE_HADOLINT=false' \
|
||||||
|
-e 'VALIDATE_GO=false' \
|
||||||
|
-e 'VALIDATE_JSCPD=false' \
|
||||||
|
-e 'VALIDATE_SHELL_SHFMT=false' \
|
||||||
|
-v $(PWD):/tmp/lint \
|
||||||
|
github/super-linter
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint: lint-go lint-rest
|
||||||
|
|
||||||
|
.PHONY: lint-fix
|
||||||
|
lint-fix: lint-md lint-go
|
||||||
|
|
||||||
|
.PHONY: fix
|
||||||
|
fix:
|
||||||
|
make lint-fix fix=true
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: build
|
install: build
|
||||||
@cp dist/local/act $(PREFIX)/bin/act
|
@cp dist/local/act $(PREFIX)/bin/act
|
||||||
|
|
13
README.md
13
README.md
|
@ -1,8 +1,7 @@
|
||||||
![](https://github.com/nektos/act/wiki/img/logo-150.png)
|
![act-logo](https://github.com/nektos/act/wiki/img/logo-150.png)
|
||||||
|
|
||||||
# Overview [![push](https://github.com/nektos/act/workflows/push/badge.svg?branch=master&event=push)](https://github.com/nektos/act/actions) [![Join the chat at https://gitter.im/nektos/act](https://badges.gitter.im/nektos/act.svg)](https://gitter.im/nektos/act?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Go Report Card](https://goreportcard.com/badge/github.com/nektos/act)](https://goreportcard.com/report/github.com/nektos/act) [![awesome-runners](https://img.shields.io/badge/listed%20on-awesome--runners-blue.svg)](https://github.com/jonico/awesome-runners)
|
# Overview [![push](https://github.com/nektos/act/workflows/push/badge.svg?branch=master&event=push)](https://github.com/nektos/act/actions) [![Join the chat at https://gitter.im/nektos/act](https://badges.gitter.im/nektos/act.svg)](https://gitter.im/nektos/act?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Go Report Card](https://goreportcard.com/badge/github.com/nektos/act)](https://goreportcard.com/report/github.com/nektos/act) [![awesome-runners](https://img.shields.io/badge/listed%20on-awesome--runners-blue.svg)](https://github.com/jonico/awesome-runners)
|
||||||
|
|
||||||
|
|
||||||
> "Think globally, `act` locally"
|
> "Think globally, `act` locally"
|
||||||
|
|
||||||
Run your [GitHub Actions](https://developer.github.com/actions/) locally! Why would you want to do this? Two reasons:
|
Run your [GitHub Actions](https://developer.github.com/actions/) locally! Why would you want to do this? Two reasons:
|
||||||
|
@ -21,6 +20,7 @@ Let's see it in action with a [sample repo](https://github.com/cplee/github-acti
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
## Necessary prerequisites for running `act`
|
## Necessary prerequisites for running `act`
|
||||||
|
|
||||||
`act` depends on `docker` to run workflows.
|
`act` depends on `docker` to run workflows.
|
||||||
|
|
||||||
If you are using macOS, please be sure to follow the steps outlined in [Docker Docs for how to install Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/).
|
If you are using macOS, please be sure to follow the steps outlined in [Docker Docs for how to install Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/).
|
||||||
|
@ -48,14 +48,15 @@ curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
|
||||||
If you are running Windows, download the [latest release](https://github.com/nektos/act/releases/latest) and add the binary into your PATH.
|
If you are running Windows, download the [latest release](https://github.com/nektos/act/releases/latest) and add the binary into your PATH.
|
||||||
If you are using [Chocolatey](https://chocolatey.org/) then run:
|
If you are using [Chocolatey](https://chocolatey.org/) then run:
|
||||||
|
|
||||||
[![](https://img.shields.io/chocolatey/v/act-cli)](https://community.chocolatey.org/packages/act-cli)
|
[![choco-shield](https://img.shields.io/chocolatey/v/act-cli)](https://community.chocolatey.org/packages/act-cli)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
choco install act-cli
|
choco install act-cli
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using [Scoop](https://scoop.sh/) then run:
|
If you are using [Scoop](https://scoop.sh/) then run:
|
||||||
|
|
||||||
[![](https://img.shields.io/scoop/v/act)](https://github.com/ScoopInstaller/Main/blob/master/bucket/act.json)
|
[![scoop-shield](https://img.shields.io/scoop/v/act)](https://github.com/ScoopInstaller/Main/blob/master/bucket/act.json)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
scoop install act
|
scoop install act
|
||||||
|
@ -63,7 +64,7 @@ scoop install act
|
||||||
|
|
||||||
If you are running Arch Linux, you can install the [act](https://aur.archlinux.org/packages/act/) package with your favorite package manager:
|
If you are running Arch Linux, you can install the [act](https://aur.archlinux.org/packages/act/) package with your favorite package manager:
|
||||||
|
|
||||||
[![](https://img.shields.io/aur/version/act)](https://aur.archlinux.org/packages/act/)
|
[![aur-shield](https://img.shields.io/aur/version/act)](https://aur.archlinux.org/packages/act/)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
yay -S act
|
yay -S act
|
||||||
|
@ -315,7 +316,7 @@ Want to contribute to act? Awesome! Check out the [contributing guidelines](CONT
|
||||||
|
|
||||||
## Building from source
|
## Building from source
|
||||||
|
|
||||||
- Install Go tools 1.16+ - (https://golang.org/doc/install)
|
- Install Go tools 1.16+ - (<https://golang.org/doc/install>)
|
||||||
- Clone this repo `git clone git@github.com:nektos/act.git`
|
- Clone this repo `git clone git@github.com:nektos/act.git`
|
||||||
- Run unit tests with `make test`
|
- Run unit tests with `make test`
|
||||||
- Build and install: `make install`
|
- Build and install: `make install`
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func drawGraph(plan *model.Plan) error {
|
func drawGraph(plan *model.Plan) error {
|
||||||
|
|
||||||
drawings := make([]*common.Drawing, 0)
|
drawings := make([]*common.Drawing, 0)
|
||||||
|
|
||||||
jobPen := common.NewPen(common.StyleSingleLine, 96)
|
jobPen := common.NewPen(common.StyleSingleLine, 96)
|
||||||
|
|
|
@ -28,7 +28,6 @@ func CopyFile(source string, dest string) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = os.Chmod(dest, sourceinfo.Mode())
|
_ = os.Chmod(dest, sourceinfo.Mode())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -36,7 +35,6 @@ func CopyFile(source string, dest string) (err error) {
|
||||||
|
|
||||||
// CopyDir recursive copy of directory
|
// CopyDir recursive copy of directory
|
||||||
func CopyDir(source string, dest string) (err error) {
|
func CopyDir(source string, dest string) (err error) {
|
||||||
|
|
||||||
// get properties of source dir
|
// get properties of source dir
|
||||||
sourceinfo, err := os.Stat(source)
|
sourceinfo, err := os.Stat(source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -55,7 +53,6 @@ func CopyDir(source string, dest string) (err error) {
|
||||||
objects, err := directory.Readdir(-1)
|
objects, err := directory.Readdir(-1)
|
||||||
|
|
||||||
for _, obj := range objects {
|
for _, obj := range objects {
|
||||||
|
|
||||||
sourcefilepointer := source + "/" + obj.Name()
|
sourcefilepointer := source + "/" + obj.Name()
|
||||||
|
|
||||||
destinationfilepointer := dest + "/" + obj.Name()
|
destinationfilepointer := dest + "/" + obj.Name()
|
||||||
|
@ -73,7 +70,6 @@ func CopyDir(source string, dest string) (err error) {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,7 +301,6 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor {
|
||||||
// Repos on disk point to commit hashes, and need to checkout input.Ref before
|
// Repos on disk point to commit hashes, and need to checkout input.Ref before
|
||||||
// we try and pull down any changes
|
// we try and pull down any changes
|
||||||
if hash.String() != input.Ref {
|
if hash.String() != input.Ref {
|
||||||
|
|
||||||
// Run git fetch to make sure we have the latest sha
|
// Run git fetch to make sure we have the latest sha
|
||||||
err := r.Fetch(&git.FetchOptions{})
|
err := r.Fetch(&git.FetchOptions{})
|
||||||
if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) {
|
if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) {
|
||||||
|
|
|
@ -40,7 +40,6 @@ func TestFindGitSlug(t *testing.T) {
|
||||||
assert.Equal(tt.provider, provider)
|
assert.Equal(tt.provider, provider)
|
||||||
assert.Equal(tt.slug, slug)
|
assert.Equal(tt.slug, slug)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDir(t *testing.T) string {
|
func testDir(t *testing.T) string {
|
||||||
|
|
|
@ -63,7 +63,6 @@ func NewDockerBuildExecutor(input NewDockerBuildExecutorInput) common.Executor {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
func createBuildContext(contextDir string, relDockerfile string) (io.ReadCloser, error) {
|
func createBuildContext(contextDir string, relDockerfile string) (io.ReadCloser, error) {
|
||||||
log.Debugf("Creating archive for build context dir '%s' with relative dockerfile '%s'", contextDir, relDockerfile)
|
log.Debugf("Creating archive for build context dir '%s' with relative dockerfile '%s'", contextDir, relDockerfile)
|
||||||
|
|
|
@ -62,9 +62,7 @@ func NewDockerPullExecutor(input NewDockerPullExecutorInput) common.Executor {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanImage(image string) string {
|
func cleanImage(image string) string {
|
||||||
|
|
|
@ -151,7 +151,6 @@ func (cr *containerReference) UpdateFromGithubEnv(env *map[string]string) common
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cr *containerReference) Exec(command []string, env map[string]string) common.Executor {
|
func (cr *containerReference) Exec(command []string, env map[string]string) common.Executor {
|
||||||
|
|
||||||
return common.NewPipelineExecutor(
|
return common.NewPipelineExecutor(
|
||||||
cr.connect(),
|
cr.connect(),
|
||||||
cr.find(),
|
cr.find(),
|
||||||
|
|
|
@ -23,7 +23,6 @@ type Workflow struct {
|
||||||
|
|
||||||
// On events for the workflow
|
// On events for the workflow
|
||||||
func (w *Workflow) On() []string {
|
func (w *Workflow) On() []string {
|
||||||
|
|
||||||
switch w.RawOn.Kind {
|
switch w.RawOn.Kind {
|
||||||
case yaml.ScalarNode:
|
case yaml.ScalarNode:
|
||||||
var val string
|
var val string
|
||||||
|
@ -109,7 +108,6 @@ func (j *Job) Container() *ContainerSpec {
|
||||||
|
|
||||||
// Needs list for Job
|
// Needs list for Job
|
||||||
func (j *Job) Needs() []string {
|
func (j *Job) Needs() []string {
|
||||||
|
|
||||||
switch j.RawNeeds.Kind {
|
switch j.RawNeeds.Kind {
|
||||||
case yaml.ScalarNode:
|
case yaml.ScalarNode:
|
||||||
var val string
|
var val string
|
||||||
|
@ -131,7 +129,6 @@ func (j *Job) Needs() []string {
|
||||||
|
|
||||||
// RunsOn list for Job
|
// RunsOn list for Job
|
||||||
func (j *Job) RunsOn() []string {
|
func (j *Job) RunsOn() []string {
|
||||||
|
|
||||||
switch j.RawRunsOn.Kind {
|
switch j.RawRunsOn.Kind {
|
||||||
case yaml.ScalarNode:
|
case yaml.ScalarNode:
|
||||||
var val string
|
var val string
|
||||||
|
@ -183,7 +180,6 @@ func (j *Job) GetMatrixes() []map[string]interface{} {
|
||||||
log.Debugf("Adding include '%v'", include)
|
log.Debugf("Adding include '%v'", include)
|
||||||
matrixes = append(matrixes, include)
|
matrixes = append(matrixes, include)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
matrixes = append(matrixes, make(map[string]interface{}))
|
matrixes = append(matrixes, make(map[string]interface{}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,6 @@ func updateTestExpressionWorkflow(t *testing.T, tables []struct {
|
||||||
in string
|
in string
|
||||||
out string
|
out string
|
||||||
}, rc *RunContext) {
|
}, rc *RunContext) {
|
||||||
|
|
||||||
var envs string
|
var envs string
|
||||||
keys := make([]string, 0, len(rc.Env))
|
keys := make([]string, 0, len(rc.Env))
|
||||||
for k := range rc.Env {
|
for k := range rc.Env {
|
||||||
|
@ -242,7 +241,6 @@ jobs:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRewrite(t *testing.T) {
|
func TestRewrite(t *testing.T) {
|
||||||
|
|
|
@ -109,7 +109,6 @@ func (f *stepLogFormatter) print(b *bytes.Buffer, entry *logrus.Entry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *stepLogFormatter) isColored(entry *logrus.Entry) bool {
|
func (f *stepLogFormatter) isColored(entry *logrus.Entry) bool {
|
||||||
|
|
||||||
isColored := checkIfTerminal(entry.Logger.Out)
|
isColored := checkIfTerminal(entry.Logger.Out)
|
||||||
|
|
||||||
if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" {
|
if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
const { spawnSync } = require('child_process')
|
const { spawnSync } = require('child_process')
|
||||||
const spawnArguments={
|
const spawnArguments = {
|
||||||
cwd: process.env['INPUT_CWD'],
|
cwd: process.env.INPUT_CWD,
|
||||||
stdio: [
|
stdio: [
|
||||||
process.stdin,
|
process.stdin,
|
||||||
process.stdout,
|
process.stdout,
|
||||||
process.stderr,
|
process.stderr
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
const child=spawnSync(
|
const child = spawnSync(
|
||||||
'/bin/sh',
|
'/bin/sh',
|
||||||
[ '-c' ].concat(process.env['INPUT_COMMAND']),
|
['-c'].concat(process.env.INPUT_COMMAND),
|
||||||
spawnArguments)
|
spawnArguments)
|
||||||
process.exit(child.status)
|
process.exit(child.status)
|
||||||
|
|
|
@ -336,7 +336,6 @@ func (rc *RunContext) EvalBool(expr string) (bool, error) {
|
||||||
!strings.Contains(part, "!")) && // but it's not negated
|
!strings.Contains(part, "!")) && // but it's not negated
|
||||||
interpolatedPart == "false" && // and the interpolated string is false
|
interpolatedPart == "false" && // and the interpolated string is false
|
||||||
(isString || previousOrNextPartIsAnOperator(i, parts)) { // and it's of type string or has an logical operator before or after
|
(isString || previousOrNextPartIsAnOperator(i, parts)) { // and it's of type string or has an logical operator before or after
|
||||||
|
|
||||||
interpolatedPart = fmt.Sprintf("'%s'", interpolatedPart) // then we have to quote the false expression
|
interpolatedPart = fmt.Sprintf("'%s'", interpolatedPart) // then we have to quote the false expression
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,6 @@ func updateTestIfWorkflow(t *testing.T, tables []struct {
|
||||||
out bool
|
out bool
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}, rc *RunContext) {
|
}, rc *RunContext) {
|
||||||
|
|
||||||
var envs string
|
var envs string
|
||||||
keys := make([]string, 0, len(rc.Env))
|
keys := make([]string, 0, len(rc.Env))
|
||||||
for k := range rc.Env {
|
for k := range rc.Env {
|
||||||
|
|
|
@ -539,7 +539,6 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe
|
||||||
// Interpolate the outer inputs into the composite step with items
|
// Interpolate the outer inputs into the composite step with items
|
||||||
exprEval := sc.NewExpressionEvaluator()
|
exprEval := sc.NewExpressionEvaluator()
|
||||||
for k, v := range stepContext.Step.With {
|
for k, v := range stepContext.Step.With {
|
||||||
|
|
||||||
if strings.Contains(v, "inputs") {
|
if strings.Contains(v, "inputs") {
|
||||||
stepContext.Step.With[k] = exprEval.Interpolate(v)
|
stepContext.Step.With[k] = exprEval.Interpolate(v)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue