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.
More on Jobs, Steps, Matrix & Concurrency
How does `needs` work, and what happens to a job whose dependency failed or was skipped?BeginnerWhat is the implicit `success()` in a job `if`, and why is `always()` usually the wrong fix?IntermediateWhat values can `needs.<job>.result` take?BeginnerHow does a matrix expand, and how are job names generated?BeginnerHow do `include` and `exclude` work in a matrix?IntermediateWhat do `fail-fast` and `max-parallel` do?Beginner