"Needs" in GitHub Actions

At job level, we have “needs” element which ensures a dependent job is run before the current job (as per Documentation). Is there anything at action level or step level, so that I can ensure that to run a particular step, I need to run another step?

Steps within a job run in the order they are listed, so you just need to make sure the steps are in the order you want. :slightly_smiling_face:

One possible catch: If any of your steps just starts a service or maybe a container in the background that might take a moment before it is ready. If you want to be sure it’s ready to use for the next step you might need to add some sort of mechanism that waits for the service.

Let me explain some more details. There will be many people in my team who will create their own GH workflows. I want to ensure one of the steps in the workflow is always included in the workflow before executing other steps. If they forget to include that step, the subsequent step throws an error saying, a dependency (needed step) is missing and they can add that step.

For example, let’s say every workflow will have “dotnet nuget” command. To execute this step, I want to make sure every developer includes a prerequisite step, say Install-DotNet. If they forget to include this step, the “dotnet nuget” should fail with a message which says something like “Prerequisite action Install-DotNet is missing.”. Hope this clarifies.

That is something the relying (second) step would have to check, e.g. check if a required tool is installed and fail with an error message if it is missing. There is no built-in tool to manage dependencies of actions on each other.