Skip to content

feat(pr-comment): handle 409 github_app_not_installed gracefully#105

Open
reuvenharrison wants to merge 1 commit intomainfrom
feat/handle-app-not-installed-409
Open

feat(pr-comment): handle 409 github_app_not_installed gracefully#105
reuvenharrison wants to merge 1 commit intomainfrom
feat/handle-app-not-installed-409

Conversation

@reuvenharrison
Copy link
Copy Markdown
Contributor

Summary

Pairs with oasdiff-service PR #175, which changes the App-not-installed response from HTTP 502 plain text to HTTP 409 with a structured JSON body.

When the service returns:

```
HTTP/1.1 409 Conflict
{ "code": "github_app_not_installed", "owner": ..., "repo": ..., "install_url": ... }
```

…the action now:

  1. Emits a `::error::` workflow annotation with a title and the install URL — visible inline on the PR's checks tab.
  2. Writes a markdown setup checklist to `$GITHUB_STEP_SUMMARY` — visible on the workflow run page — walking the customer through Install → select repo → re-run.
  3. Exits non-zero so the workflow fails (the action couldn't do its job).

Falls back to the existing generic-error behavior for any other non-2xx response.

Why this matters

Today's symptom: a customer signs up, sets up the action, opens a PR, gets a red X with a wall-of-log error. The fix is one click (install the App), but they have to dig through the workflow log to find the URL. After this change, the install URL is in a workflow annotation and the step summary — impossible to miss.

This complements (does not replace) a future pre-flight check in the setup wizard: even if pre-flight passes, the App can be uninstalled later, and this surfaces that gracefully.

Test plan

  • Once oasdiff-service PR #175 is deployed, run the action against a repo where the App is not installed. Verify:
    • The `::error::` annotation appears on the PR checks tab with title "oasdiff GitHub App not installed".
    • The workflow run summary shows the setup checklist with a clickable install link.
    • Exit code is non-zero (workflow fails red).
  • Run against a repo with the App installed — no regression in the success path.

🤖 Generated with Claude Code

When the service returns 409 with a github_app_not_installed code, parse
the structured JSON body and surface a clear, actionable error:

- A ::error:: workflow annotation with a title and the install URL.
- A markdown setup checklist written to \$GITHUB_STEP_SUMMARY (visible
  on the workflow run page) telling the customer exactly what to do.

Falls back to the existing generic-error behavior for any other non-2xx
response. Pairs with oasdiff-service PR #175 which switches the App-
not-installed response from HTTP 502 plain text to HTTP 409 + JSON.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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