Skip to content

Job dependencies and isolation ​

Encyclopedia home · Search machine-readable catalog

The broken snippets are deliberate negative examples. Use only in an isolated fixture repository or lab.

F031 ​

File does not cross a job boundary

Symptom. cat: version.txt: No such file or directory.

Root cause. needs orders jobs while their filesystems stay isolated.

Broken example

yaml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: echo "1.0.0" > version.txt
  deploy:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - run: cat version.txt

Corrected example

yaml
jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.generate.outputs.version }}
    steps:
      - id: generate
        run: echo "version=1.0.0" >> "$GITHUB_OUTPUT"
  deploy:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - env:
          VERSION: ${{ needs.build.outputs.version }}
        run: echo "$VERSION"

Verification. Expect the downstream step to print 1.0.0. Use artifacts for actual files.

Correction validation syntax-validated.

F048 ​

Gate skips when tests fail

Symptom. check is skipped instead of failing.

Root cause. Implicit success prevents the gate from inspecting a failed upstream result.

Broken example

yaml
needs: [test]

Corrected example

yaml
needs: [test]
if: ${{ !cancelled() }}

Verification. Read needs.test.result in the gate and return nonzero unless success.

Correction validation syntax-validated.

F049 ​

Missing dependency declares a race

Symptom. intermittent missing artifact.

Root cause. Consumer starts before package job finishes.

Broken example

yaml
steps: [{run: "./ci/install-release.sh"}]

Corrected example

yaml
needs: [package]
steps: [{run: "./ci/install-release.sh"}]

Verification. Add explicit upload/download and validate dependency graph.

Correction validation syntax-validated.

F050 ​

Job output references a nonexistent step

Symptom. empty digest in downstream job.

Root cause. The producer step ID is publish.

Broken example

yaml
outputs:
  digest: ${{ steps.deploy.outputs.digest }}

Corrected example

yaml
outputs:
  digest: ${{ steps.publish.outputs.digest }}

Verification. Validate nonempty digest and compare expected value.

Correction validation syntax-validated.

F051 ​

Attempt to depend on a job in another workflow

Symptom. unknown dependency other-workflow-build.

Root cause. needs accepts only job IDs within the same workflow.

Broken example

yaml
needs: other-workflow-build

Corrected example

yaml
on:
  workflow_run:
    workflows: ["Build"]
    types: [completed]

Verification. Run Build and filter its completed outcome in the consumer.

Correction validation syntax-validated.

F052 ​

Repeated environment name does not serialize deploys

Symptom. overlapping writes occur.

Root cause. Environment protection and concurrency are separate.

Broken example

yaml
environment: staging

Corrected example

yaml
environment: staging
concurrency: {group: staging-deploy, cancel-in-progress: false}

Verification. Trigger two approved runs and observe queue behavior.

Correction validation syntax-validated.

F053 ​

Each job must check out source

Symptom. ci/test.sh: No such file or directory.

Root cause. No checkout occurs merely because an upstream job checked out source.

Broken example

yaml
steps:
  - run: ./ci/test.sh

Corrected example

yaml
steps:
  - uses: actions/checkout@v4
    with: {persist-credentials: false}
  - run: ./ci/test.sh

Verification. Confirm git rev-parse works in the dependent job.

Correction validation syntax-validated.

F054 ​

Job uses repeated matrix output key

Symptom. consumer sees only one platform output.

Root cause. Multiple jobs can race to provide the same output name.

Broken example

yaml
outputs:
  artifact: ${{ steps.build.outputs.artifact }}

Corrected example

yaml
uses: actions/upload-artifact@v4
with:
  name: "app-${{ matrix.os }}"
  path: dist/

Verification. Collect uniquely named artifacts and verify target set.

Correction validation syntax-validated.