Skip to content
CodeKruPro

Why do tests fail only on pull requests from forks?

QuizMedium-Hard

An open-source project's API tests read secrets.API_TOKEN. They pass on branches in the main repository but fail with 401 on pull requests opened from forks (copies of the repository made by other people). Why?

  • For workflows triggered by pull requests from forks, GitHub does not pass repository secrets to the runner (except GITHUB_TOKEN, which is read-only)
  • Forks use a different version of GitHub Actions
  • The API blocks all requests from GitHub runners
  • Secrets expire after each pull request

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in