Commit graph

155 commits

Author SHA1 Message Date
KADOTA, Kyohei
316b078f8c
Shouldn't rewrite dot in a string to index syntax (#502)
Co-authored-by: Casey Lee <cplee@nektos.com>
2021-02-08 09:14:12 -08:00
Taiju Muto
eca1b9c478
Add lacking environment variables. (#513) 2021-01-31 21:59:51 -08:00
Cat™
8339f4b404
Interpolate with: inputs (#511) 2021-01-30 17:43:11 -08:00
KADOTA, Kyohei
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
Cat™
e37b42a333
Print error with workflow/job information when runs-on key is not defined (#494)
Co-authored-by: Casey Lee <cplee@nektos.com>
2021-01-21 06:02:48 -08:00
KADOTA, Kyohei
719a077b7c
Stop current execution if there is the invalid syntax in the workflow (#495) 2021-01-21 06:00:33 -08:00
Ed
c7b3869b2f
Report error when if expression is invalid (#485)
Co-authored-by: Ed Tan <edtan@users.noreply.github.com>
Co-authored-by: Casey Lee <cplee@nektos.com>
2021-01-18 11:44:27 -08:00
KADOTA, Kyohei
e6fcfed458
Format sources with gofmt (#472)
Co-authored-by: Casey Lee <cplee@nektos.com>
2021-01-14 21:37:38 -08:00
Cat™
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 Saville
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™
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 Vatn
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™
80a245652e
Add option to disable hiding of secrets (#460) 2021-01-11 22:28:45 -08:00
Cat™
a9b3d6426b
Use static initial PATH (#462) 2021-01-11 22:27:16 -08:00
Steffen Seckler
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 Saville
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 Vatn
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 Vatn
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 Vatn
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 Seckler
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 Tissen
d5b2d60c35
Add variadic version of hashFiles (#411) 2020-11-09 09:08:57 -08:00
Wink Saville
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 Saville
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 Young
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 Sisson
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 Romero
729adec5e5
Fix path for local node12 actions (#371)
Fixes #185

Signed-off-by: Javier Romero <root@jromero.codes>
2020-09-29 13:39:45 -07:00
Leonardo Dino
44151f208e
Add CI=true environment variable (#372)
fixes #333
see https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
2020-09-28 08:22:42 -07:00
Owen
1070c58538
feat: support custom GITHUB_RUN_ID, GITHUB_RUN_NUMBER (#369)
* feat: add fromJSON support

* feat: support custom runId and runNumber

* chore: manual update

* chore: lint
2020-09-22 14:13:29 -07:00
Tom Lazar
7d443c6520
Set the default branch inside the event data (#354)
* set ${{github.event.repository.default_branch}}

* change `ok == false` to `!ok`

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-09-02 07:56:44 -07:00
Owen
d521fa5bba
feat: add fromJSON support (#352) 2020-09-01 13:55:29 -07:00
Yoan Blanc
3eef111e46
chore: upgrade docker v19.03.12 (#348)
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-08-29 22:55:22 -07:00
Julian Squires
e698e8b324
Support setting shell via defaults.run (#343)
Note that we don't support the more general use of defaults, just its
run key for setting shell and working directory.

The documentation for defaults.run is here:
  https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun

Fixes #214.

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-08-28 11:52:25 -07:00
watiko
26e4270e41
fix file permission for non root user docker image (#334) 2020-08-08 13:31:26 -07:00
Casey Lee
0ccc867f30
Merge branch 'master' into feat/add-privileged-mode 2020-08-01 19:05:56 -07:00
Tachibana waita
9a661538e6
actions/hello-world-javascript-action@master moved to main, use stable tag (#326) 2020-08-01 19:05:25 -07:00
whywaita
24bdb024bf
add flag of privileged mode 2020-08-02 05:21:49 +09:00
Denys Vitali
ae39a4b1d3
fix(test): adapt to sjw change 2020-07-20 21:43:36 +02:00
Denys Vitali
cc369e2f73
fix: add default values in vmInput 2020-07-20 21:17:49 +02:00
Amit Mahbubani
0b9268ada7
Fix comments on StepType enum consts (#304) 2020-07-13 09:39:23 -07:00
Ayaz BADOURALY
7dcd0bc1bb
Rewrite contexts before evaluating them (#287)
* Rewrite contexts before evaluating them

* Precompile context and expression patterns

* Test trim before rewrite

The current contextPattern is quite constraining and would fail the
rewrite of a context with trailing spaces. Triming happens during the
execution of Interpolate, and these tests aim to detect future breaking
changes on this behavior.

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-06-24 07:08:45 -07:00
Josh Soref
64b8d2afa4
Properly pass format argument to avoid MISSING (#290)
#273
2020-06-24 07:05:05 -07:00
Jeremy Lempereur
7cc668707b
remove .gitignore before docker cp (#288)
* Test setup before I try to understand how things work

* Remove .gitignore before we run docker cp
2020-06-23 11:57:24 -07:00
Stan Wohlwend
d4e41a90a2
Fix container volumes being reused sometimes (#283) 2020-06-18 08:21:55 -07:00
Josh Soref
5c850b5ba8
Fix using: node12 handling (#243)
Co-authored-by: Casey Lee <cplee@nektos.com>
2020-05-18 14:31:09 -07:00
Josh Soref
2097a3c017
Spelling (#240)
* spelling: cartesian

* spelling: deferring

* spelling: marshal
2020-05-18 09:53:42 -07:00
Michael Heap
d3f25bac79
Mask secrets in job output (#231)
Previously secrets would be shown in log output as provided. This
commit updates the stepLogFormatter to replace any instance of the secret
string with "***", as GitHub Actions would

Known issues: If the secret is a generic string (such as "docker"), all
occurances of that string will be replaced in the output

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-05-13 15:22:31 -07:00
Michael Heap
a5e86bd024
Add support for changing the GITHUB_ACTOR (#229)
This adds the `-a` flag when running `act` to change the username of the GITHUB_ACTOR environment variable

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-05-12 00:14:56 -07:00
Torbjørn Vatn
a149cf8ca2
Make envs available in if conditionals (#225)
* Ignore .idea

* Add Env to the RunContext vm so we can Evaluate and Interpolate `env.xx`

* Make EvalBool support expressions more in line with the github runner

* Turns out Boolean(value) is what github is doing after all

* Add test for github context as well
2020-05-04 12:18:13 -07:00
Michael Heap
6d6ea7ac04
Implement UnmarshalYAML for ActionRunsUsing (#223)
In #222 I added case normalisation to ReadAction() to ensure that Docker and docker are interpreted the same way.

I realised that this was being done at the wrong level and required multiple type conversions. By implementing `func (a ActionRunsUsing) UnmarshalYAML` we can lowercase the string as it's being unserialized

This has an added benefit that any time this type is hydrated the `runs.using` key will be lowercased, rather than relying on `ReadAction()`
2020-05-04 05:40:11 -07:00
Michael Heap
195a6c9ffb
Add default error case for Runs.Using (#221)
The string comparison in `step_context.go` is currently case sensitive. This commit adds an error that returns the valid options and tells the user what value they passed
2020-05-03 20:55:20 -07:00
Casey Lee
a48cce3a78
fix: #170 add RUNNER_TEMP 2020-04-23 08:18:36 -07:00
Casey Lee
a9533b05ce
fix: #170 #171 - add RUNNER_OS and RUNNER_TEMP 2020-04-22 23:57:36 -07:00
Casey Lee
8c290994c1
fix: #182 - support symlinks in workspace 2020-04-22 23:24:31 -07:00
Juan Eugenio Abadie
b95fdb896f
Use env variables in Action.Runs.Env (#201)
* Use env variables in Action.Runs.Env

* Use Action.Runs.Env in all the cases
2020-04-19 11:29:34 -07:00
jony montana
2f395475b0
feat: load every environment from --env-file to workflow (#184)
* feat: load every environment from --env-file to workflow

* fix: pass dotenv's environments through by context

* updates to support --secret-file

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-04-17 10:04:40 -07:00
Alberto Fernández
67542608a2
Remove length constraint (#190) 2020-04-16 16:05:00 -07:00
Aidan Steele
4a4bd36cf6
Add support for runs-on array form (closes #146) (#155)
* Add support for runs-on array form (closes #146)

* Fixed style issues

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-03-16 14:58:10 -07:00
Aidan Steele
b670173764
Add support for step.working-directory (closes #149) (#154) 2020-03-14 00:00:37 -07:00
Casey Lee
c439a6ff14
support nested expressions 2020-03-12 17:22:33 -07:00
Casey Lee
16520bb277
fix #122 - support actions/checkout for repos other the one for this workflow (#143) 2020-03-09 17:45:42 -07:00
Casey Lee
143676fcfb
fix #141 - use host network to match GitHub Actions runners (#142) 2020-03-09 17:43:24 -07:00
Casey Lee
15fb58bf43
fix #134 - include base_ref and head_ref in github context from the event json 2020-03-06 14:17:57 -08:00
Casey Lee
87392c2ed7
fix #134 - support 'env' context in steps 2020-03-06 13:39:01 -08:00
Casey Lee
4fde7d8865
fix #121 and #123 - add support for reading env variables from .env (#133) 2020-03-06 12:30:24 -08:00
Casey Lee
af970769d7
fix #127 - force eval as a boolean (#131) 2020-03-06 11:30:39 -08:00
Casey Lee
c32a87c6dc
fix #128: guard against empty actionName when 'uses: ./' (#130)
* fix #128: guard against empty actionName when 'uses: ./'

* fix #129 - force image name to be lowercase
2020-03-06 10:17:20 -08:00
Casey Lee
59b9b8e97a
fix #108 - ensure container names are unique for matrix runs 2020-03-04 16:24:14 -08:00
Casey Lee
e9de6ca2c0
fix #115 - support toJson and toJSON (#116) 2020-02-28 15:20:31 -08:00
Casey Lee
6e1da1a70d
fix #110 - support path in action (#111) 2020-02-27 14:17:01 -08:00
Casey Lee
21e2bb8657
fix #108 - support matrix expressions in job name (#109) 2020-02-26 23:29:43 -08:00
Casey Lee
8696b42178
gofmt 2020-02-25 16:58:26 -08:00
Casey Lee
9dd2428546
fix #100 - change RUNNER_TOOL_CACHE to /opt/hostedtoolcache (#103) 2020-02-25 08:52:04 -08:00
Casey Lee
51b6167606
fix 99: support string and map variants of container 2020-02-24 22:35:08 -08:00
Casey Lee
1121f6e132
run with copy of workingdir 2020-02-24 17:48:21 -08:00
Casey Lee
8f5918942d
move action cache to volume 2020-02-24 16:38:49 -08:00
Casey Lee
037e08a3a7
integration test 2020-02-24 12:48:12 -08:00
Casey Lee
6c632946be
unit tests pass 2020-02-24 10:56:49 -08:00
Casey Lee
88041afb87
cache dir for remote actions 2020-02-23 22:34:48 -08:00
Casey Lee
94591c58d7
local actions done 2020-02-23 16:36:44 -08:00
Casey Lee
ac1bd0893e
shared container for job 2020-02-23 15:02:01 -08:00
Casey Lee
01876438c2
shared container for job 2020-02-23 15:01:25 -08:00
Casey Lee
9179d8924d
updates for tests 2020-02-21 22:19:59 -08:00
Casey Lee
2cb276ca05
unchecked error 2020-02-21 08:42:00 -08:00
Casey Lee
418b0db047
reuse containers to fix #86 2020-02-20 22:43:20 -05:00
Casey Lee
9511f5baf4
fix unit tsts for runner
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:16 -05:00
Casey Lee
543501a36a
add support to override platform
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:15 -05:00
Casey Lee
573f78e1b4
support for secrets
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:09 -05:00
Casey Lee
9651992584
code complexity of NewPlanExecutor
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:07 -05:00
Casey Lee
60be2d67c1
align name of job in output
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:05 -05:00
Casey Lee
f8fb88816a
matrix is done
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:03 -05:00
Casey Lee
5b7019cd0b
skip unsupported platforms
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:01 -05:00
Casey Lee
73559207c7
initial support for expressons
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:59 -05:00
Casey Lee
09773f7c5c
fix tests
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:57 -05:00
Casey Lee
e40ab0145f
expressions working
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:55 -05:00
Casey Lee
fd6fe1872f
bug with local action
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:48 -05:00
Casey Lee
64562d41ab
test updates
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:44 -05:00
Casey Lee
f7252cbcf9
add commands support
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:42 -05:00
Casey Lee
033168228b
cleanup logging
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:40 -05:00
Casey Lee
a21d4bbd90
ignore actions/checkout locally
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:38 -05:00
Casey Lee
835b36cb63
ci tests
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:36 -05:00