Repository navigation
fix: pin GITHUB_REPOSITORY in tests so CI passes on forks - #1693
danielh-official wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
GitHub Actions sets GITHUB_REPOSITORY to the running repo's owner/name. On forks that differs from dev-null-sh/dev-null.sh, so tests mocking GitHubProvider calls for the upstream repo fail. Set it via <server> because Laravel's env() reads $_SERVER before $_ENV.
f69a0f8 to
f054129
Compare
Summary
config/services.phpreads the repository slug fromenv('GITHUB_REPOSITORY', 'dev-null-sh/dev-null.sh'). GitHub Actions always setsGITHUB_REPOSITORYto the running repo'sowner/name. Upstream that matches the default, so tests pass. On a fork it doesn't (e.g.danielh-official/devnull.com), so every test that mocksGitHubProvidercalls fordev-null-sh/dev-null.shfails withMockery\Exception\NoMatchingExpectationException. Example fork run: https://github.com/danielh-official/devnull.com/actions/runs/47371419077Forks can't override this from repo settings: GitHub reserves the
GITHUB_prefix for variables and secrets.Changes
phpunit.xml: add<server name="GITHUB_REPOSITORY" value="dev-null-sh/dev-null.sh"/>.<server>rather than<env force="true">: PHPUnit's<env>only sets$_ENV/putenv, while Laravel'senv()reads$_SERVERfirst, where the runner's real environment lives. With<env force="true">the fork value still won.Validation
Local, the previously failing groups (About, Changelog, IssueSuggestion controllers; ChangelogQuery; NullGitHubProvider;
tests/Unit/Ai/Tools), 128 tests:GITHUB_REPOSITORY=danielh-official/devnull.com php artisan test --compact …: failed before the change, 128 passed after.GITHUB_REPOSITORY=dev-null-sh/dev-null.sh php artisan test --compact …: 128 passed.env -u GITHUB_REPOSITORY php artisan test --compact tests/Feature/Controllers/AboutControllerTest.php: 6 passed.Summary by CodeRabbit