Commit Graph
279 Commits
Author SHA1 Message Date
Josh SorefandGitHub 020d6a6083 Composite action (#608)
* Refactor maybeCopyToActionDir

* Use maybeCopyToActionDir for model.ActionRunsUsingComposite
2021-05-03 14:57:46 -07:00
cec63488f3 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 <[email protected]>
2021-05-03 09:52:03 -07:00
RenstromandGitHub 3db3d416e3 Fixes Issue #597 (#637)
* feat:(Changed order of events, to prevent enviroment to run before if statement is run

* changed issue597 to issue-597

* Added test for linux/amd64
2021-05-03 09:51:48 -07:00
cc3e7aeaf2 GitHub Event Path #542 (#605)
Co-authored-by: Casey Lee <[email protected]>
2021-05-03 08:02:26 -07:00
806bc4d999 refactor: NewWorkflowPlanner (#648)
feat: add flag `--no-recurse` to disable recursion when reading workflows from directories
feat: added more tests to `TestPlanner`, renamed `TestJobFileInfo` to more appropriate name `WorkflowPlanTest`
style: changed error message to lowercase, added single quotes for better visibility

Co-authored-by: Casey Lee <[email protected]>
2021-05-03 07:57:24 -07:00
7ae9916de0 Add option to allow files/directories in .gitignore to be copied to container (#537)
* disable gitignore for actions

* feat: Add option to allow/disallow paths specified in .gitignore

Co-authored-by: Alan Birtles <[email protected]>
2021-05-03 07:37:20 -07:00
Ryan (hackercat)andGitHub f32babb51d fix: reworked container architecture (#619)
- Don't set architecture, let Docker host decide it's own platform,
  remove `runtime` dependency and don't show default in `--help`
- Remove most tests, we need to check only once if it works on
  different platform
- Rename `DeleteImage` to `RemoveImage` to conform to existing
  function in `docker` cli, added options to specify `force` and
  `pruneChildren`
2021-05-02 08:15:13 -07:00
hackercatandGitHub 4125812a63 Refactor .actrc locations and default image survey (#600)
* refactor: move survey/cfgs into own funcs, read XDG base dirs for config

Moved actrc locations to own func since it can be reused.
Moved survey part to own func due to high cyclomatic complexity.
Added XDG config dir to config locations.
Replaced using HOME envvar with go-homedir module since it's already
an indirect dependency and handles home directories better
for each GOOS.

* refactor: use `go-homedir`, check if XDG var is not empty
2021-04-05 08:51:13 -07:00
b9a7bc6202 Add support for composite actions (#514)
* Add support for composite actions

* Fix to make more complex composite actions work

* Fix to make more complex composite actions work

* Let's validate the steps in the composite steps to fail on uses and run's without shell, like the real world

* Add support for composite actions

* Add workflow to test composite actions

* Log instead of panicing when output is mismatched

* Merge maps so environment variables are not lost

* Remove Debug

* Correect merge error

* Remove invalid composite tests.

* Fix composite test

Co-authored-by: Casey Lee <[email protected]>
Co-authored-by: monkers <[email protected]>
Co-authored-by: Mike Moncrieffe <[email protected]>
2021-04-02 13:40:44 -07:00
hackercatandGitHub 5044ec6c43 fix: remove HOME env var (#594) 2021-04-01 14:01:01 -07:00
hackercatandGitHub 25779af4bf fix: return error if both run:/uses: keys are used (#593)
fixes https://github.com/nektos/act/issues/536
2021-04-01 11:36:41 -07:00
5752a03dcd Support running commands in repositories without action.yaml (#293)
* Comment for public function

* Add git describe fallback

* spelling: github

* Set initial branch to satisfy tests for modern git

* Clarify -even- if

* Go 1.16

* Support running commands in repositories without action.yaml

Support runnings commands with only a Docker file

Co-authored-by: Casey Lee <[email protected]>
2021-03-30 12:26:25 -07:00
957b8ad76d Update Shell Tasks to match ScriptHandlerHelpers (#575)
* Update Shell Tasks to match ScriptHandlerHelpers
Code: https://github.com/actions/runner/blob/main/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs

Docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell

Fixes #467

* 🩹 Remove old ps1 handler

* ♻️ gocritix fix

* 🐛 Powershell command must be a single entry to docker API
Fixes #467

* Remove Act Temp

* Remove additional Act Directories

* remove hard-coded workdir

Co-authored-by: Casey Lee <[email protected]>
2021-03-29 10:06:51 -07:00
hackercatandGitHub 29b3d43988 fix: hardcode ubuntu-latest for ImageOS envvar (#579)
Hardcode current `ubuntu-latest` since we have no way to check that 'on the fly'
2021-03-28 21:46:09 -07:00
hackercatandGitHub f3b53d8eca fix: pass sc.Env through common.Logger to hide secrets (#578)
Currently all secrets are exposed when running with `--verbose`/`-v` option
2021-03-28 21:45:07 -07:00
rockandskaandGitHub 6cde8f64dc use project dir instead of /github/workspace (#567) 2021-03-28 21:32:45 -07:00
6c258cf40d Add option to run custom architecture (container platform) (#525)
* Add QEMU to run different architectures

* Update dependencies in `go.mod`

* Add `--container-architecture` flag to specify custom image architecture

Co-authored-by: Casey Lee <[email protected]>
2021-03-28 21:08:40 -07:00
hackercatandGitHub 41b03b581c fix: add ImageOS env var based on running platform (#571) 2021-03-17 17:14:08 -07:00
hackercatandGitHub 09679f0156 Update test workflows and improve expression_test.go/run_context_test.go (#560)
* fix: give case insensitive secret more meanigful name

* refactor: use `string` in generating `env:` and `steps:` for workflows

Smaller text generation is much better to read with normal strings than
raw string literals.

* feat: sort keys for `env:` so it's always in specific order

* fix: update test workflows
2021-03-12 16:25:10 -08:00
hackercatandGitHub eb2774275f Fix tests on Windows (#562)
* fix: replace `\` with `/` in git ref to fix `git_test.go` on windows

Paths on Windows use backslash (`\`) as directory separator and this breaks `TestGitFindRef()`.
Replacing `\` with `/` in git ref fixes that issue.

* fix: replace `gopkg.in/godo.v2/glob` with std library `path/filepath`

`github.com/go-godo/godo` lib has been last updated in 2016 and it also
depends on another outdated lib `github.com/MichaelTJones/walk` with
last update in 2016. This also fixes `permission_denied` errors on
Windows (and perhaps Linux in some specific cases). I'm not aware of
any performance improvement or drawback because of that change.
2021-03-12 16:23:03 -08:00
8de7b956b7 Add --userns flag to support Docker daemon that enables user namespace (#533)
I got an error like this after hitting `act` command.

> Error: Error response from daemon: cannot share the host's network namespace when user namespaces are enabled

According to the document, when user namespaces are enabled on the Docker daemon,
neither host network mode and --privileged work without --userns=host. Since `act`
uses host network mode to match GitHub Actions runners, it cannot run jobs when
user namespaces are enabled. So I added the flag.

https://docs.docker.com/engine/security/userns-remap/#user-namespace-known-limitations

Co-authored-by: Casey Lee <[email protected]>
2021-02-27 08:31:25 -08:00
6c118fe9ad #534 feat: step continues when continue-on-error is ture (#544)
* feat: step continues when continue-on-error is ture

* fix: typo, logging and make bool continuable

Co-authored-by: Casey Lee <[email protected]>
2021-02-25 08:55:07 -08:00
hackercatandGitHub 34dc2dc15c Update Docker images (#524) 2021-02-23 09:49:24 -08:00
Kamil DomańskiandGitHub 475a6aa1d0 properly parse arguments to Docker container steps (#539) 2021-02-23 09:47:06 -08:00
316b078f8c Shouldn't rewrite dot in a string to index syntax (#502)
Co-authored-by: Casey Lee <[email protected]>
2021-02-08 09:14:12 -08:00
Taiju MutoandGitHub eca1b9c478 Add lacking environment variables. (#513) 2021-01-31 21:59:51 -08:00
Cat™andGitHub 8339f4b404 Interpolate with: inputs (#511) 2021-01-30 17:43:11 -08:00
KADOTA, KyoheiandGitHub 2d1a946fb1 Throw an error if the steps has a invalid uses directive (#500)
* Throw an error if the steps has a invalid uses directive

* Refactor TestStepContextExecutor
2021-01-23 08:07:28 -08:00
e37b42a333 Print error with workflow/job information when runs-on key is not defined (#494)
Co-authored-by: Casey Lee <[email protected]>
2021-01-21 06:02:48 -08:00
KADOTA, KyoheiandGitHub 719a077b7c Stop current execution if there is the invalid syntax in the workflow (#495) 2021-01-21 06:00:33 -08:00
c7b3869b2f Report error when if expression is invalid (#485)
Co-authored-by: Ed Tan <[email protected]>
Co-authored-by: Casey Lee <[email protected]>
2021-01-18 11:44:27 -08:00
e6fcfed458 Format sources with gofmt (#472)
Co-authored-by: Casey Lee <[email protected]>
2021-01-14 21:37:38 -08:00
Cat™andGitHub 460ed2db04 Update parts of repo (#476)
* Update flags in README

* Add secrets and `.env` files examples

* Fix typo: environment

* Fix typo: returned

* Add --version back, since I've built act without ldflags
2021-01-14 21:21:44 -08:00
Wink SavilleandGitHub f2c15074ac Fix issue 416 (#423)
This is a solution to issue #416 where environment variables created or
changed in the previous step are not usable in the next step because
the rc.ExprEval is from the beginning of the previous step.

This change refactors setupEnv so that before interpolating the environment
variables a NewExpressionEvaluator is created.


Fixes: 416
2021-01-12 16:02:54 -08:00
Cat™andGitHub 2811101dea Make all secrets case insensitive by formatting them to uppercase (#470)
* Uppercase secrets, print error when secret with same name already exists

* Test lower-to-upper case formatting for secrets
2021-01-12 09:54:53 -08:00
Torbjørn VatnandGitHub 15eaa15a0e GitHub env file support (#426)
* Upgrade to the official golangci-lint action and fix some issues it found

* Update deps

* Remove a shadow warning

* Initialize the splitPattern only once

* Initial attempt at supporting $GITHUB_ENV

Needs some polishing and tests

* Now it's actually working

* Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term

* Disable the issue-228 test again

* The linter is picky

* Discovered that the workflow/envs.txt had to exist in certain cases

* Fix small linter issue
2021-01-11 22:39:43 -08:00
Cat™andGitHub 80a245652e Add option to disable hiding of secrets (#460) 2021-01-11 22:28:45 -08:00
Cat™andGitHub a9b3d6426b Use static initial PATH (#462) 2021-01-11 22:27:16 -08:00
Steffen SecklerandGitHub e47a2395a5 Fixes include when using matrix and strategy build. (#415)
* fixes include directive of strategy build.

* Adds test for include and exclude in matrix builds.

* ubuntu-16.04 instead of 20.04

* Adds more platforms for runner_test

Prevent most "skipping unsupported platform messages".

* correct printing for unsupported platform

* fix merge
2020-12-08 10:13:07 -08:00
Wink SavilleandGitHub d784bce96a Extract runTestJobFile from TestRunEvent (#429)
This will allow other tests to be created in runner_test.go that can
be tested individually.
2020-11-29 21:45:11 -08:00
Torbjørn VatnandGitHub b3299ecd30 Act env (#417)
* Test more if env variants

* The correct negation syntax is !=

* Make the Interpolate function support negated booleans from envs

* Move assert := a.New(t) into t.Run

This uncovered that some of the test premisses was wrong and the
Eval Bool function also had flaws

* Remove a stray logrus import

* Add an ACT env set to true

This can be used to skip certain steps that you don't want to run locally
when testing. E.g. steps that sends messages to Slack channels on successful
builds etc.

* Add a description about env.ACT to the readme

* A new attempt at Interpolation and EvalBool

* One small merge fix

* Remove some fmt.Printfs

* Fix some merge conflicts
2020-11-18 07:14:34 -08:00
Torbjørn VatnandGitHub 8ba3306aa4 EvalBool and Interpolation fixes (#424)
* A new attempt at Interpolation and EvalBool

* One small merge fix

* Remove some fmt.Printfs
2020-11-17 09:31:05 -08:00
Torbjørn VatnandGitHub 3f4998a4ed envs in if: - take 2 (#412)
* Test more if env variants

* The correct negation syntax is !=

* Make the Interpolate function support negated booleans from envs

* Move assert := a.New(t) into t.Run

This uncovered that some of the test premisses was wrong and the
Eval Bool function also had flaws

* Remove a stray logrus import
2020-11-12 08:15:09 -08:00
Steffen SecklerandGitHub 695c496684 Adds ability to use container images from matrices. (#413)
Uses rc.ExprEval.Interpolate on container image.
2020-11-10 14:55:27 -08:00
Peter TissenandGitHub d5b2d60c35 Add variadic version of hashFiles (#411) 2020-11-09 09:08:57 -08:00
Wink SavilleandGitHub 3f3de6e0b1 Use PathListSeparator (#408)
In PR #406 I used PathSeparator and I should have used PathListSeparator.
 See: https://golang.org/pkg/os/#pkg-constants
2020-11-04 11:54:48 -08:00
Wink SavilleandGitHub 8204ef4b82 Change handling of ExtraPath (#406)
To make the handling of ExtraPath portable append it to the front of the
PATH when it exists, instead of always changing the script.
2020-11-02 13:56:20 -08:00
Owen YoungandGitHub 92067eb1a5 fix: outputs espace (#404)
* fix: outputs espace

* refactor: move unescape to func

* refactor: fix ci lint

* refactor: unescape function
2020-11-02 05:40:46 -08:00
Taliesin SissonandGitHub 014d71af43 When running on Windows the correct path separator must be used (#386)
* When running on Windows the correct path separator must be used. filePath.join is OS aware, so when we want to use forward slash use path.join instead.

on windows docker cp should end with \. when copying a directory
when running npm modules we should pass in path with all forward slashes

This fixes #331

* When calculating relative folders on Windows for destination path on Linux, we need to change \ for /

* Reduce complexity by extracting methods

* V1 does not point to a file that does not exist

* Looks like something else is the cause of this test breaking. Last successful build is #371, builds after that are failing
2020-10-08 22:30:50 -07:00
Javier RomeroandGitHub 729adec5e5 Fix path for local node12 actions (#371)
Fixes #185

Signed-off-by: Javier Romero <[email protected]>
2020-09-29 13:39:45 -07:00