Deployment

When a GitHub Actions Job Is Skipped, Every Job That Needs It Is Skipped Too

A workflow that looks fine in the editor can quietly do nothing when it matters. The test job fails, the deploy job never starts, and the run shows as unsuccessful — but the part you were watching for, the part that would have told you why, was skipped. This is not a runner problem or a permissions problem. It is a documented consequence of needs, and it is worth understanding before you build a deployment workflow around it.

The rule, in the documentation

GitHub’s workflow syntax reference puts it in one sentence:

If a job fails or is skipped, all jobs that need it are skipped unless the jobs use a conditional expression that causes the job to continue.

The same paragraph continues:

If a run contains a series of jobs that need each other, a failure or skip applies to all jobs in the dependency chain from the point of failure or skip onwards.

That second sentence is the one people miss. needs does not form a set of independent gates; it forms a chain. A skip at any point propagates to every downstream job in that chain, whether those jobs declared the failed job directly or only declared another job that was itself skipped.

Why the skip travels

The reason is that needs is defined in terms of success, not completion. The syntax reference says to use it “to identify any jobs that must complete successfully before this job will run.” If the prerequisite did not succeed, the dependent job does not run at all. A skipped job counts as not having succeeded, so the next job in the chain is skipped too — and so on.

A short chain makes this visible:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: make build
  test:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - run: make test
  deploy:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - run: make deploy

If test is skipped, deploy is skipped even though it never declared a dependency on test failing — it declared a dependency on test succeeding, and that condition was not met.

For a deployment pipeline this is usually the behaviour you want. A failed test should stop the deploy. The problem starts when the chain also contains work you do want to happen after a failure: cleaning up temporary resources, publishing a failure report, uploading logs, notifying someone.

The condition you did not write

Every if in a workflow is evaluated against a default. GitHub’s expression reference states it plainly:

A default status check of success() is applied unless you include one of these functions.

So a job with no if at all behaves as if it had if: success(). When the prerequisite fails, success() is false, the job is skipped, and the skip propagates. Adding if: always() changes that default — but it changes more than most people intend.

The always() trap

The expression reference describes always like this:

Causes the step to always execute, and returns true, even when canceled.

Then it adds a warning:

Avoid using always for any task that could suffer from a critical failure, for example: getting sources, otherwise the workflow may hang until it times out. If you want to run a job or step regardless of its success or failure, use the recommended alternative: if: ${{ !cancelled() }}

That is the distinction worth remembering. always() runs the job when a prerequisite failed and when the run was cancelled. !cancelled() runs it after a failure but stays away when someone cancels the run — which is usually what you meant if you said “I want this to run even if the build failed.”

The two patterns side by side:

IntentCondition on the downstream job
Only deploy after successno if — the default success() applies
Report or clean up after a failureif: ${{ !cancelled() }}
Run even during cancellation (upload logs, release a lock)if: ${{ always() }}

A cleanup job should normally use the second row. A log-upload step on a job that is itself being cancelled may need the third.

What this does to a real deploy workflow

Consider a static site that deploys through an external hook. The build-and-test chain runs on GitHub; the actual publication happens through a deploy hook, which is an HTTP call that starts a separate build on the host. I have described the direct Cloudflare Pages path in deploying a static site to Cloudflare Pages, but the dependency question is the same either way: if the job that calls the hook is skipped, nothing is published, and there is no failure message from the host because the host was never contacted.

Two practical consequences follow:

Keep the notification job outside the chain it reports on. If notify needs test, and test was skipped, notify is skipped too. Give the reporting job its own condition with !cancelled() and read the status from the needs context rather than relying on being triggered.

Do not put build configuration in a job that can be skipped. Variables that the deploy step needs must be available at the workflow or environment level, not written to disk by an earlier job that may never run. The reason is the same as the one in environment variables on a static site: a build-time value has to exist at build time, and a skipped job cannot create it.

A short checklist

  1. Draw the needs chain on paper before writing it. Mark which jobs are allowed to stop the chain and which must run after a failure.
  2. For every job that must run after a failure, add if: ${{ !cancelled() }} explicitly. Do not rely on always() unless cancellation should also trigger it.
  3. Check the needs context if a job needs to know which prerequisite failed, rather than assuming it will be triggered.
  4. Verify by deliberately failing a test in a branch. A workflow that has never failed has never had its dependency chain exercised.

The original sentence — “if a job fails or is skipped, all jobs that need it are skipped” — is worth quoting exactly because it sounds harsher than it is. It is the correct default for deployment. It becomes a problem only when work that must happen after a failure is placed inside the same chain.

Sources

Primary documentation only — the provider's own page, the specification, or the standard itself. Claims that rest on anything else are described in the text as a market pattern or an inference, not as documentation.

  1. GitHub Docs — Workflow syntax: jobs.<job_id>.needs (the dependency and skip rule, quoted verbatim)
  2. GitHub Docs — Evaluate expressions: status check functions (default success(), and the !cancelled() recommendation)
  3. Cloudflare Pages — Deploy hooks (triggering a deploy from an external workflow)

Written by . Spotted something out of date? Tell us.