Interview Prep/GitHub Actions/Jobs, Steps, Matrix & Concurrency

What is the order of execution of `pre`, main and `post` steps for actions?

AdvancedConceptJobs, Steps, Matrix & Concurrency
Answer

JavaScript and Docker actions can define pre, main and post entry points. All pre scripts run at the start of the job (during "Set up job", in step order), then the main steps in order, then all post scripts in reverse order at job end ("Post Run actions/cache@v4"). post-if defaults to always(). This is why caches save even when a later step fails, and why actions/checkout's post step removes the persisted credentials.

All GitHub Actions questions Roadmap: GitHub Actions

More on Jobs, Steps, Matrix & Concurrency