Interview Prep/CI/CD/GitHub Actions

A release workflow must run when a tag `v1.2.3` is pushed and publish a GitHub Release with notes.

BeginnerScenarioGitHub Actions
Answer

Situation read → Tag-triggered release.

What I'd do →

on:
  push:
    tags: ['v*.*.*']
permissions:
  contents: write
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: gh release create "$GITHUB_REF_NAME" --generate-notes dist/*
        env: { GH_TOKEN: "${{ github.token }}" }

Why → gh release create --generate-notes builds notes from merged PRs, and contents: write is scoped to this workflow.

Interview tip → Keep write permissions only on the job that needs them.

All CI/CD questions

More on GitHub Actions