Commit graph

21 commits

Author SHA1 Message Date
Jon Jensen
ace4cd47c7
Fix float formatting (#2018)
Format floats the same way as actions/runner (precision 15, remove
trailing zeroes)

See: 67d70803a9/src/Sdk/DTObjectTemplating/ObjectTemplating/Tokens/NumberToken.cs (L34)
2023-10-13 20:01:04 +00:00
ChristopherHX
7c7d80ebdd
fix: use actions/runner hashfiles in container (#1940)
* fix: use actions/runner hashfiles in container

Previously hashfiles ran on the host,
this don't work for container generated content

* fix: lint

* fix: lint

* fix assign follow symlink flag

Co-authored-by: Jason Song <i@wolfogre.com>

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-10-03 22:56:18 +00:00
ChristopherHX
73d5f78294
Shorten or/and in expressions (#1939)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-08-08 14:30:13 +00:00
Casey Lee
724ec918c9
chore: upgrade golangci-lint and address findings (#1904) 2023-07-10 17:12:12 -07:00
Kuan Yong
6ce45e3f24
feature: Add support for github action variables (#1833)
* feature: Add support for github action variables

* add --var flag for github variables

* unitests: Updated unittests to cover vars context.

* Remove syntax extension for vars and correct unit tests

* Update pkg/runner/expression.go

Co-authored-by: ChristopherHX <christopher.homberger@web.de>

---------

Co-authored-by: kuanyong-wong-partior <kuanyong.wong@partior.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2023-06-10 18:09:27 +00:00
Jason Song
ac5dd8feb8
fix: return err in walk (#1667)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-03-08 15:13:11 +00:00
Alex Savchuk
973dd7f7ef
fix: compare properties of Invalid types (#1645)
* fix: compare properties of Invalid types

 fix: compare properties of Invalid types #1643

* fix linter problem

* Fix review comment
2023-03-03 08:16:33 +00:00
Markus Wolf
89cb558558
fix: update output handling for reusable workflows (#1521)
* fix: map job output for reusable workflows

This fixes the job outputs for reusable workflows. There is
a required indirection. Before this we took the outputs from
all jobs which is not what users express with the workflow
outputs.

* fix: remove double evaluation

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-23 22:34:47 +00:00
Aaron Holmes
bef9b5c3c7
feat: Support "result" on "needs" context. (#1497)
* Support "result" on "needs" context.

This change adds "result" to a job's "needs" context, as documented [here](https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context). `act` currently tracks the success/failure/cancelled status of a job, but does not include this value the `needs` context.

Fixes #1367

* Change `Needs` to use a new struct rather than the open type `interface{}`.

Related #1497
Fixes #1367

* Add integration test to "needs" context change.

Relates: #1497

* feat: allow to spawn and run a local reusable workflow (#1423)

* feat: allow to spawn and run a local reusable workflow

This change contains the ability to parse/plan/run a local
reusable workflow.
There are still numerous things missing:

- inputs
- secrets
- outputs

* feat: add workflow_call inputs

* test: improve inputs test

* feat: add input defaults

* feat: allow expressions in inputs

* feat: use context specific expression evaluator

* refactor: prepare for better re-usability

* feat: add secrets for reusable workflows

* test: use secrets during test run

* feat: handle reusable workflow outputs

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* refactor: fix savestate in pre steps (#1466)

* refactor: fix savestate in pre steps

* fix pre steps collision

* fix tests

* remove

* enable tests

* Update pkg/runner/action.go

* Rename InterActionState to IntraActionState

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* fix: tail (not absolute) as entrypoint of job container (#1506)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Fix conflict in merge.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-19 08:37:53 +00:00
Randolph Chung
5200c49155
fix: handle subdirectors and exclusions (#1012) (#1446) 2022-11-21 14:47:38 +00:00
Alex Savchuk
48188a6280
fix: support docker create arguments from container.options (#1022) (#1351)
* fix: support docker create arguments from container.options (#1022)

* fix processing of errors, add verbose logging, fix test

* disable linter for code copied from docker/cli

* fix all linter issues

* Add license info

* Add opts_test.go from docker/cli and required testdata

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-10-06 22:09:43 +00:00
Markus Wolf
943a0e6eea
implement pre and post steps (#1089)
* feat: add post step to actions and add state command

This commit includes requried changes for running post steps
for local and remote actions.
This allows general cleanup work to be done after executing
an action.

Communication is allowed between this steps, by using the
action state.

* feat: collect pre and post steps for composite actions

* refactor: move composite action logic into own file

* refactor: restructure composite handling

* feat: run composite post steps during post step lifecycle

* refactor: remove duplicate log output

* feat: run all composite post actions in a step

Since composite actions could have multiple pre/post steps inside,
we need to run all of them in a single top-level pre/post step.

This PR includes a test case for this and the correct order of steps
to be executed.

* refactor: remove unused lines of code

* refactor: simplify test expression

* fix: use composite job logger

* fix: make step output more readable

* fix: enforce running all post executor

To make sure every post executor/step is executed, it is chained
with it's own Finally executor.

* fix: do not run post step if no step result is available

Having no step result means we do not run any step (neither pre
nor main) and we do not need to run post.

* fix: setup defaults

If no pre-if or post-if is given, it should default to 'always()'.
This could be set even if there is no pre or post step.
In fact this is required for composite actions and included post
steps to run.

* fix: output step related if expression

* test: update expectation

* feat: run pre step from actions (#1110)

This PR implements running pre steps for remote actions.
This includes remote actions using inside local composite actions.

* fix: set correct expr default status checks

For post-if conditions the default status check should be
always(), while for all other if expression the default status
check is success()

References:
https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions
https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runspost-if

* fix: remove code added during rebase
2022-05-24 13:36:06 +00:00
ChristopherHX
77ddc89444
fix: conclusion and outcome are no integers (#1136)
* fix: conclusion and outcome are no integers

* Change Test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-04-26 20:24:13 +00:00
ChristopherHX
93575124d3
fix: do not error that much (#1137)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-04-26 20:14:56 +00:00
ChristopherHX
a970145c95
Fix: panic: reflect: slice index out of range (#1066)
* Fix: panic: reflect: slice index out of range

* Update interpreter.go

* [no ci] Return null for negative indexes

* Add tests for index access

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-03-22 14:05:36 -04:00
ChristopherHX
380bd581b1
Fix: call of reflect.Value.Interface on zero Value (#1067)
panic: reflect: call of reflect.Value.Interface on zero Value

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-03-22 09:03:36 +00:00
ChristopherHX
5083284deb
Fix: tojson(null) == 'null' (#1068)
* Fix: tojson(null) == 'null'

* Update test

* Update functions_test.go
2022-03-22 08:55:13 +00:00
Björn Brauer
aab2af0919
fix: coerce booleans to numbers for comparison in exprparser (#1030)
Co-Authored-By: Markus Wolf <markus.wolf@new-work.se>

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: Casey Lee <cplee@nektos.com>
2022-03-14 16:38:42 +00:00
Björn Brauer
c24cfc72f4
Expression evaluator fixes (#1009)
* refactor: remove debug error output

Errors should always be logged with an error level and not debug level.
Since the error is returned here, it will be logged later as an error.
Presumably this was a leftover from debugging the executor chain in:
PR: #971

* refactor: debug log wich expression is going to be evaluated

* fix: handle nil in EvalBool

We've seen this issue when the env map is not set-up properly,
i.e. when the env map is nil, EvalBool might return nil, which should
be handled as a falsy value.

* fix: fail on error in if expression and return the evaluation error

Stop running the workflow in case an expression cannot be evaluated.

Fixes: #1008

* fix: remove quotes from inside expression syntax in test

It looks like having an expression inside double quotes inside the
expression syntax is not valid: https://github.com/ZauberNerd/act-test/actions/runs/1881986429
The workflow is not valid. .github/workflows/test.yml (Line: 10, Col: 13): Unexpected symbol: '"endsWith'. Located at position 1 within expression: "endsWith('Hello world', 'ld')"

* refactor: export IsTruthy function from exprparser package

* refactor: use IsTruthy function in EvalBool

* refactor: move debug log for expression rewrite to rewrite function

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-25 18:39:50 +00:00
Björn Brauer
ff13844b86
refactor: default empty if: statement to if: success() in evaluator & remove FixIfStatement() (#990)
* refactor: default empty `if:` statement to `if: success()` in evaluator

Previously the code to default an empty `if:` statement in the yaml file
was implemented in different files in the model package.
Now an empty `if:` statement defaults to `success()` in the expression
evaluator.

* refactor: remove obsolete `FixIfStatement` functions

The introduction of the expression evaluator seems to have made these
functions obsolete, as the test case `TestRunEvent/issue-598` works even
without these functions.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 20:03:00 +00:00
Björn Brauer
eba71f98fe
Refactor expression evaluator to use parser from actionlint package (#908)
* feat: implement expression evaluator

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se>

* feat: integrate exprparser into act

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se>

* Escape { and }, do not fail on missing properties

* Fix empty inputs context

* fix: contains() comparison for complex values

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: Philipp Hinrichsen <philipp.hinrichsen@new-work.se>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
2022-01-21 08:07:20 -08:00