Celebrate onboarding and agent wins with GitHub star prompts (#5642)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson
2026-06-17 22:21:32 -07:00
committed by GitHub
co-authored by Orca
parent 4a3ec0232f
commit fd9e79a77a
38 changed files with 2026 additions and 204 deletions
+40
View File
@@ -97,6 +97,7 @@ vi.mock('./rate-limit', () => ({
}))
import {
checkOrcaStarred,
getPRComments,
getPRForBranch,
getRepoUpstream,
@@ -112,6 +113,45 @@ import {
_resetMergeQueueCacheForTests
} from './client'
describe('checkOrcaStarred', () => {
beforeEach(() => {
execFileAsyncMock.mockReset()
acquireMock.mockReset()
releaseMock.mockReset()
acquireMock.mockResolvedValue(undefined)
})
it('returns true only for an included successful GitHub response', async () => {
execFileAsyncMock.mockResolvedValueOnce({ stdout: 'HTTP/2.0 204 No Content\r\n', stderr: '' })
await expect(checkOrcaStarred()).resolves.toBe(true)
expect(execFileAsyncMock).toHaveBeenCalledWith(
'gh',
['api', '--include', 'user/starred/stablyai/orca'],
{ encoding: 'utf-8' }
)
})
it('returns true for an HTTP 200 starred response', async () => {
execFileAsyncMock.mockResolvedValueOnce({ stdout: 'HTTP/2.0 200 OK\r\n', stderr: '' })
await expect(checkOrcaStarred()).resolves.toBe(true)
})
it('returns false for GitHub 404 not starred responses', async () => {
execFileAsyncMock.mockRejectedValueOnce(new Error('HTTP 404: Not Found'))
await expect(checkOrcaStarred()).resolves.toBe(false)
})
it('returns null when gh exits successfully without response headers', async () => {
execFileAsyncMock.mockResolvedValueOnce({ stdout: '', stderr: '' })
await expect(checkOrcaStarred()).resolves.toBe(null)
})
})
describe('getPRForBranch', () => {
beforeEach(() => {
execFileAsyncMock.mockReset()
+10 -2
View File
@@ -236,8 +236,16 @@ function isNoPullRequestError(err: unknown): boolean {
export async function checkOrcaStarred(): Promise<boolean | null> {
await acquire()
try {
await execFileAsync('gh', ['api', `user/starred/${ORCA_REPO}`], { encoding: 'utf-8' })
return true
const { stdout, stderr } = await execFileAsync(
'gh',
['api', '--include', `user/starred/${ORCA_REPO}`],
{ encoding: 'utf-8' }
)
const response = `${stdout ?? ''}\n${stderr ?? ''}`
if (/HTTP\/\S+\s+(?:200|204)\b/.test(response)) {
return true
}
return null
} catch (err) {
const message = err instanceof Error ? err.message : String(err)
// 404 means the user hasn't starred — the only expected "no" answer