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

implement pre and post steps #1089

Merged
merged 19 commits into from
May 24, 2022
Merged

implement pre and post steps #1089

merged 19 commits into from
May 24, 2022

Conversation

KnisterPeter
Copy link
Member

This is a continuation of #1010

This change implements action post step in combination with the save-state command.
It does support the post-if condition.

There are a few preparations for action pre steps, but it's not fully implemented in this PR.

Closes #626

@KnisterPeter KnisterPeter self-assigned this Mar 30, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Mar 30, 2022

MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ CREDENTIALS secretlint yes no 0.97s
✅ EDITORCONFIG editorconfig-checker 26 0 0.68s
✅ GIT git_diff yes no 0.01s
✅ YAML prettier 3 0 0.54s
✅ YAML v8r 3 0 2.17s

See errors details in artifact MegaLinter reports on CI Job page
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

@codecov
Copy link

codecov bot commented Mar 30, 2022

Codecov Report

Merging #1089 (41b1e90) into master (4f8da0a) will increase coverage by 3.99%.
The diff coverage is 79.18%.

@@            Coverage Diff             @@
##           master    #1089      +/-   ##
==========================================
+ Coverage   57.50%   61.50%   +3.99%     
==========================================
  Files          32       40       +8     
  Lines        4594     5287     +693     
==========================================
+ Hits         2642     3252     +610     
- Misses       1729     1781      +52     
- Partials      223      254      +31     
Impacted Files Coverage Δ
pkg/model/action.go 0.00% <0.00%> (ø)
pkg/model/github_context.go 79.51% <ø> (ø)
pkg/model/planner.go 50.73% <ø> (+0.32%) ⬆️
pkg/model/step_result.go 0.00% <ø> (ø)
pkg/model/workflow.go 54.29% <0.00%> (+3.38%) ⬆️
pkg/container/docker_run.go 5.01% <1.96%> (-0.53%) ⬇️
pkg/common/git.go 49.31% <28.57%> (-0.52%) ⬇️
pkg/container/file_collector.go 44.85% <44.85%> (ø)
pkg/exprparser/interpreter.go 73.37% <53.48%> (-0.02%) ⬇️
pkg/runner/runner.go 73.72% <73.68%> (-2.75%) ⬇️
... and 23 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@KnisterPeter KnisterPeter changed the base branch from master to remove-composite-runcontext-workaround March 31, 2022 09:32
@KnisterPeter KnisterPeter marked this pull request as ready for review April 4, 2022 09:05
@KnisterPeter KnisterPeter requested a review from a team as a code owner April 4, 2022 09:05
@KnisterPeter
Copy link
Member Author

@nektos/act-maintainers I've added a few test to make sure our post steps run and run in order.
This should be fine now 🎉

@mergify mergify bot requested a review from a team April 4, 2022 09:50
@mergify
Copy link
Contributor

mergify bot commented Apr 6, 2022

@KnisterPeter this pull request is now in conflict 😩

@mergify mergify bot added the conflict PR has conflicts label Apr 6, 2022
@mergify mergify bot removed the conflict PR has conflicts label Apr 6, 2022
@KnisterPeter KnisterPeter force-pushed the remove-composite-runcontext-workaround branch from a711610 to 2d06b71 Compare April 6, 2022 12:06
@mergify
Copy link
Contributor

mergify bot commented Apr 6, 2022

@KnisterPeter this pull request is now in conflict 😩

@mergify mergify bot added the conflict PR has conflicts label Apr 6, 2022
@mergify mergify bot removed the conflict PR has conflicts label Apr 6, 2022
@mergify
Copy link
Contributor

mergify bot commented Apr 8, 2022

@KnisterPeter this pull request is now in conflict 😩

@mergify mergify bot added the conflict PR has conflicts label Apr 8, 2022
@mergify
Copy link
Contributor

mergify bot commented May 23, 2022

@KnisterPeter this pull request is now in conflict 😩

@mergify mergify bot added the conflict PR has conflicts label May 23, 2022
@cplee
Copy link
Contributor

cplee commented May 24, 2022

@KnisterPeter - tested on branch and ready to merge once conflict is fixed

@mergify mergify bot removed the conflict PR has conflicts label May 24, 2022
KnisterPeter and others added 18 commits May 24, 2022 09:53
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.
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.
To make sure every post executor/step is executed, it is chained
with it's own Finally executor.
Having no step result means we do not run any step (neither pre
nor main) and we do not need to run post.
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.
This PR implements running pre steps for remote actions.
This includes remote actions using inside local composite actions.
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
@mergify
Copy link
Contributor

mergify bot commented May 24, 2022

@KnisterPeter this pull request has failed checks 🛠

@mergify mergify bot added the needs-work Extra attention is needed label May 24, 2022
@mergify mergify bot removed the needs-work Extra attention is needed label May 24, 2022
@mergify mergify bot merged commit 943a0e6 into master May 24, 2022
@mergify mergify bot deleted the implement-pre-and-post-steps branch May 24, 2022 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue: "post" run not executed
4 participants