Skip to main content
InterviewHubPRO
Section Overview
Q2

Question 2 of 50

Part 1: CI/CD Fundamentals & GitHub Actions Core (Junior / Entry-Level)

4%
CI/CD & GitHub Actions (50 Qs)•Part 1: CI/CD Fundamentals & GitHub Actions Core (Junior / Entry-Level)

Explain the fundamental components of a GitHub Actions workflow.

junior LevelMost AskedCode ExampleComponentsState ManagementCI/CD & DevOps

In Simple Words: GitHub Actions automation is defined in YAML files located inside .github/workflows/.

Core Building Blocks:

  1. Workflows: Configured automated processes made of one or more jobs (e.g., ci.yml).
  2. Events / Triggers (on): Specific activities that trigger the workflow (e.g., push, pull_request, schedule).
  3. Jobs: A set of steps executed on the same runner. Jobs run in parallel by default, unless sequenced with needs: [job_id].
  4. Runners: Virtual machines or containers executing the jobs (e.g., runs-on: ubuntu-latest).
  5. Steps: Individual tasks within a job. Can run shell commands (run:) or actions (uses:).
  6. Actions: Standalone reusable commands packaged as open-source or custom scripts (e.g., actions/checkout@v4).
yaml
# .github/workflows/ci.yml
name: Continuous Integration
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    name: Run Unit Tests
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4
        
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: 'npm'

      - name: Install & Test
        run: |
          npm ci
          npm test