No post run capability for composite actions?

According to Metadata syntax for GitHub Actions - GitHub Docs, it looks like there isn’t the ability to specify steps for the action to be executed “post run”. This capability exists for Javascript and Docker actions but not composite.

Is that correct? Just making sure I’ve correctly interpreted the documentation.

@pcolmer,

Is that correct? Just making sure I’ve correctly interpreted the documentation.

Yes, it is correct. The pre and post option are not available to the composite run steps actions.

Generally, you can think of the composite action as just a combination of some run steps. When you run the a composite action in the workflow, it is functionally equivalent to directly executing the combined run steps in the workflow.

If you want to run some pre or post scripts for the composite action, you can directly combine the run as a step in the action:

  • Set the first step in the composite action to run some pre scripts to set up some preparations for the subsequent run steps in the composite action.

  • Set the last step in the composite action to run some post scripts to cleanup some data generated by the previous run steps in the composite action.

Thanks for the clarification/confirmation.

Unfortunately (for me), I was primarily wanting to use the composite action as a means of creating an action that allowed a broader support of languages other than Docker and Javascript. So, in that regard, I needed the post script to always run in the workflow even if a previous step had failed.

Ultimately, I ended up going with a Javascript Action.

@pcolmer,

I needed the post script to always run in the workflow even if a previous step had failed.

Unlike directly executing the run steps in the job, the option “runs.steps.if” is not supported. So you can’t set an if conditional (e.g. if: always()) to let a run step to always run when any previous run steps is failed in the composite action.