Interview Prep/GitHub Actions/Pipeline Design & Triggers

You want to run expensive E2E tests only when a PR has the `run-e2e` label, and re-run when the label is added. How?

IntermediateScenarioPipeline Design & Triggers
Answer

Situation read → Needs the labeled activity type plus a condition.

What I'd do →

  1. Trigger on the label event and filter on the label name:
    on:
      pull_request:
        types: [opened, synchronize, reopened, labeled]
    jobs:
      e2e:
        if: contains(github.event.pull_request.labels.*.name, 'run-e2e')
    
  2. Use a concurrency group per PR so adding another label does not run E2E twice in parallel.
  3. Make E2E non-required, or required through the fan-in job that treats skipped as pass.

Why → Labels are a cheap opt-in for expensive suites.

Interview tip → Note that labeled fires for any label, hence the contains filter.

All GitHub Actions questions Roadmap: GitHub Actions

More on Pipeline Design & Triggers