Git & GitHub Interview Question #88

What are jobs and steps in GitHub Actions?

GitHub Collaboration, Repository Rules, Issues, Releases & Actions CI/CD Mid-Level Intermediate

Quick Interview Answer

A workflow contains one or more jobs. A job runs on a configured runner and contains an ordered sequence of steps. Steps can execute shell commands or invoke reusable actions.

Detailed Explanation

A workflow contains one or more jobs. A job runs on a configured runner and contains an ordered sequence of steps. Steps can execute shell commands or invoke reusable actions.

Jobs run independently by default and may run in parallel when capacity is available. Dependencies between jobs can be expressed when one job must wait for another.

Code Example

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Restore
        run: dotnet restore
      - name: Build
        run: dotnet build --no-restore