Replies: 1 comment
|
For a JavaScript action used directly in a workflow step, pass env:
CLEANUP_JOB_STATUS: ${{ job.status }}Then in const status = process.env.CLEANUP_JOB_STATUS;
const failed = status === 'failure';
// Always perform cleanup; use `failed` for the failure-specific branch.Keep The useful detail is that this is evaluated again for the post step, rather than frozen at the main action's invocation. The runner registers the post runner with the same action definition, then evaluates the step environment when that step runs. This path also exists in runner v2.316.1. So don't capture the value in your main script with Two distinctions: |
Uh oh!
There was an error while loading. Please reload this page.
I have a custom action (node) executed via a runner and a post-step to clean up after itself. The post step needs to know if any of the previous steps have failed. It always needs to do its cleanup (so i cannot use the post-if) but the cleanup looks slightly different if its a failed job. So how do I do that best?
I've tried using the API (which is hard because its (1) lagging and (2) the job correct job is not easily identifiable. It also doesnt seem to be available in the context. So i wonder if i can in any way get this information via the runner? or some data of the runner? Happy to contribute also if this is not available and deemed useful.
All reactions