Git & GitHub Interview Question #86

What is a GitHub Actions workflow?

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

Quick Interview Answer

A workflow is an automated process defined in a YAML file under .github/workflows. It contains triggers and one or more jobs, with each job containing steps that run commands or reusable actions.

Detailed Explanation

A workflow is an automated process defined in a YAML file under .github/workflows. It contains triggers and one or more jobs, with each job containing steps that run commands or reusable actions.

A repository can have multiple workflows, for example separate workflows for pull-request validation, deployment, scheduled maintenance, and release publishing.

Code Example

name: Build

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: dotnet build