Skip to content

GitHubWriteAdapter

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/apps/api/src/docs-pr/git-write/github-write.adapter.ts

Opens (or updates) a docs-fix PR on GitHub via the existing GitHub App installation token. Hand-rolled REST over axios to match the house style (no octokit in the repo).

Strategy: the head branch always carries exactly ONE commit off the base tip, so the PR diff is clean and a follow-up push simply force-updates that single commit — GitHub then updates the same PR (dedupe by head branch). Nothing merges automatically.

Extends: GitWriteAdapter

Methods

MethodSignatureReturns
openOrUpdatePropenOrUpdatePr(input: OpenOrUpdatePrInput)Promise<OpenOrUpdatePrResult>

Where it refuses work

  • GitHubWriteAdapter stops the work with Error when baseRef.status !== 200.
  • GitHubWriteAdapter stops the work with WriteNotPermittedError when !creds?.password.
  • GitHubWriteAdapter stops the work with WriteNotPermittedError when res.status === 403.
  • GitHubWriteAdapter stops the work with an early return when input.token.

Was this page helpful?

Download as PDF