Interview Prep/GitHub Actions/Workflows Not Triggering & Invalid Files

The workflow runs on push to `main` but never on pull requests.

BeginnerTroubleshootingWorkflows Not Triggering & Invalid Files
Answer

Likely causes → pull_request.branches lists the head branch instead of the base, the PR is a draft and jobs skip drafts, the PR has merge conflicts (no merge commit can be created, so pull_request runs do not start), or path filters exclude the changed files.

Diagnose →

yq '.on' .github/workflows/ci.yml
gh pr view 42 --json mergeable,isDraft,baseRefName,files

Fix → Filter by base branch (branches: [main]), resolve conflicts, adjust paths.

Prevent → Document that branches under pull_request means target branch.

All GitHub Actions questions Roadmap: GitHub Actions

More on Workflows Not Triggering & Invalid Files