Skip to content

[Fix] Resolves issue with GitHub App Auto Creation#1153

Merged
RichardAnderson merged 1 commit into
vitodeploy:4.xfrom
RichardAnderson:fix/githubapp
Jun 10, 2026
Merged

[Fix] Resolves issue with GitHub App Auto Creation#1153
RichardAnderson merged 1 commit into
vitodeploy:4.xfrom
RichardAnderson:fix/githubapp

Conversation

@RichardAnderson

@RichardAnderson RichardAnderson commented Jun 9, 2026

Copy link
Copy Markdown
Member

Github App automatic creation currently fails with the error: links/0/schema', [] is not a null or object.

This was due to Laravel automatically sending and empty array on post, whereas Github expects a null or empty string. This PR resolves this by moving to sending the post manually instead of using the ->post helper.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error handling for GitHub app creation from manifest, with more informative error messages that include API response details.
    • Added detailed logging for failed manifest conversion requests to improve troubleshooting and debugging capabilities.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The GitHub app manifest conversion process is enhanced with better observability and error reporting. A User-Agent header is added to outbound HTTP requests, conversion failures are logged with full response details, and error messages from the GitHub API response are extracted and included in the ValidationException. A test verifies the request is sent to the correct endpoint.

Changes

GitHub App Manifest Conversion Error Handling

Layer / File(s) Summary
Manifest conversion request and error handling
app/Actions/GithubApp/CreateGithubAppFromManifest.php, tests/Feature/GithubAppTest.php
The manifest conversion request now includes a User-Agent header, logs failures with status and response body, and throws a ValidationException with the message extracted from the JSON response appended. The test verifies the HTTP request is sent to the correct GitHub API endpoint with an empty body.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly addresses the main change: fixing an issue with GitHub App automatic creation by improving error handling and request formatting.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/Actions/GithubApp/CreateGithubAppFromManifest.php (1)

13-13: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Optional: Add PHPDoc @throws annotation.

The method throws ValidationException but lacks a PHPDoc block documenting this. As per coding guidelines, @throws annotations must reflect reality.

📝 Proposed PHPDoc addition
+    /**
+     * Create a GitHub App from a manifest code.
+     *
+     * `@throws` ValidationException
+     */
     public function create(string $code): GithubApp
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Actions/GithubApp/CreateGithubAppFromManifest.php` at line 13, The create
method in CreateGithubAppFromManifest::create throws a ValidationException but
has no PHPDoc; add a PHPDoc block above the public function create(string
$code): GithubApp documenting the thrown exception (e.g., `@throws`
ValidationException) so tools and readers know this can be raised; ensure the
exception class is the correct namespaced type used in the method.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Actions/GithubApp/CreateGithubAppFromManifest.php`:
- Around line 33-40: The validation error builds a message in
CreateGithubAppFromManifest::(throw ValidationException::withMessages) that
always includes a colon even when $message is empty, producing "HTTP 404):.";
change the logic that builds 'status_message' so the colon and message are only
appended when $message is non-empty (e.g., compute $status_message = $message
!== '' ? ': '.$message : '' and pass that into the __('Failed to convert
manifest (HTTP :status):status_message.') call or adjust the translation string
to not hardcode the colon), ensuring the thrown
ValidationException::withMessages uses the cleaned-up $status_message.

In `@tests/Feature/GithubAppTest.php`:
- Around line 81-84: Update the Http::assertSent closure in the test to also
check that the outgoing request method is POST and that the User-Agent header
set in the Action (line 24) is present and equals the expected value; locate the
Http::assertSent(...) closure and add checks against $request->method() ===
'POST' and $request->header('User-Agent') (or headerLine) matching the Action's
User-Agent value so the assertion validates URL, body, method, and header.

---

Outside diff comments:
In `@app/Actions/GithubApp/CreateGithubAppFromManifest.php`:
- Line 13: The create method in CreateGithubAppFromManifest::create throws a
ValidationException but has no PHPDoc; add a PHPDoc block above the public
function create(string $code): GithubApp documenting the thrown exception (e.g.,
`@throws` ValidationException) so tools and readers know this can be raised;
ensure the exception class is the correct namespaced type used in the method.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 692b0892-ea29-4766-aea6-3ee75859b9d8

📥 Commits

Reviewing files that changed from the base of the PR and between 829c726 and 5c238c3.

📒 Files selected for processing (2)
  • app/Actions/GithubApp/CreateGithubAppFromManifest.php
  • tests/Feature/GithubAppTest.php

Comment thread app/Actions/GithubApp/CreateGithubAppFromManifest.php
Comment thread tests/Feature/GithubAppTest.php
@RichardAnderson RichardAnderson merged commit 51d5a26 into vitodeploy:4.x Jun 10, 2026
4 checks passed
@RichardAnderson RichardAnderson deleted the fix/githubapp branch June 10, 2026 11:56
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.

2 participants