Skip to content

fix: pin GITHUB_REPOSITORY in tests so CI passes on forks - #1693

Open
danielh-official wants to merge 1 commit into
dev-null-sh:productionfrom
danielh-official:fix/pin-github-repository-in-tests
Open

danielh-official wants to merge 1 commit into
dev-null-sh:productionfrom
danielh-official:fix/pin-github-repository-in-tests

Conversation

@danielh-official

@danielh-official danielh-official commented Dec 4, 2026 •

Copy link
Copy Markdown

Summary

config/services.php reads the repository slug from env('GITHUB_REPOSITORY', 'dev-null-sh/dev-null.sh'). GitHub Actions always sets GITHUB_REPOSITORY to the running repo's owner/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 mocks GitHubProvider calls for dev-null-sh/dev-null.sh fails with Mockery\Exception\NoMatchingExpectationException. Example fork run: https://github.com/danielh-official/devnull.com/actions/runs/47371419077

Forks 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's env() reads $_SERVER first, 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

  • Chores
    • Updated project configuration. This change does not affect any visible product features or behavior.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PHPUnit configuration now sets the GITHUB_REPOSITORY server variable to dev-null-sh/dev-null.sh.

Changes: PHPUnit configuration

Layer / File(s) Summary
Set repository server variable
phpunit.xml
Adds the GITHUB_REPOSITORY server variable with the value dev-null-sh/dev-null.sh.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested reviewers: xheaven, nunomaduro

Merge Risk: Minimal · up to f0541

This only changes the test configuration so that fork CI runs use the upstream repository slug. It does not affect production behavior, and merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: pinning GITHUB_REPOSITORY in test configuration so CI passes on forks. The phpunit.xml change adds a server variable GITHUB_REPOSITORY set to dev-null-sh/dev-null.sh, …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: pinning GITHUB_REPOSITORY in test configuration so CI passes on forks. The phpunit.xml change adds a server variable GITHUB_REPOSITORY set to dev-null-sh/dev-null.sh, and the PR objectives confirm that fork runs otherwise fail. The title is short, specific, and uses the fix: prefix with a clear subject.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cad46a3b-7294-4c12-b9a9-41e1bfe0be64
Commits

Reviewing files that changed from the base of the PR and between baa02bb and f054129.

Files selected for processing: 1

  • phpunit.xml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

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.
@danielh-official
danielh-official force-pushed the fix/pin-github-repository-in-tests branch from f69a0f8 to f054129 Compare December 4, 2026 16:23
@danielh-official
danielh-official marked this pull request as ready for review December 4, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant