Skip to content
Latchkey

How to Skip a Job on Forks in GitHub Actions

Forks run your scheduled and push workflows too, so a deploy job can fire from someone else fork unless you guard it.

Gate the job with an if that checks github.repository against your canonical owner/name so forks skip it.

Steps

  • Decide which jobs must never run on a fork, such as deploys.
  • Add an if expression checking github.repository equals your repo.
  • Forks evaluate the condition false and skip the job.
  • Keep build and test jobs unguarded so contributors still get CI.

Workflow

.github/workflows/skip-on-fork.yml
name: Skip On Fork
on: [push, schedule]
jobs:
  deploy:
    if: github.repository == 'acme/app'
    runs-on: ubuntu-latest
    steps:
      - run: ./deploy.sh

Notes

  • Scheduled workflows do not run on forks at all, but push and dispatch can, so still guard those.
  • Latchkey managed runners run your guarded upstream jobs cheaper and self-heal mid-run.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →