@eduardo191labs/opencode-actions 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/detect.d.ts CHANGED
@@ -36,9 +36,43 @@ export declare function fetchRepoInfo(github: GitHub, ref: RepoRef): Promise<Rep
36
36
  /** Detect the stack and the workflows already in a repository. */
37
37
  export declare function detect(github: GitHub, ref: RepoRef): Promise<Detection>;
38
38
  /**
39
- * The set of workflows the installer writes into a repository. Each one is
40
- * narrow: it only runs on its own event, so a repository with a busy PR queue
41
- * does not spend runners on unrelated events.
39
+ * The whole point of the app is that the bot acts as itself, not as the
40
+ * repository's `GITHUB_TOKEN`. A `permissions:` block also *caps*
41
+ * `GITHUB_TOKEN`, which is a separate credential, so both exist side by side:
42
+ * the app token does the writing, and `GITHUB_TOKEN` keeps a narrow read scope
43
+ * for anything else a step might touch.
44
+ *
45
+ * The action mints the installation token on every run, so what travels in the
46
+ * repository secrets is the app id and private key, never a token that would
47
+ * expire within the hour.
48
+ */
49
+ /**
50
+ * The `permissions:` block written into every workflow.
51
+ *
52
+ * This caps `GITHUB_TOKEN`, a credential separate from the app's installation
53
+ * token. The app token does the writing; this block exists so that anything a
54
+ * step does with the default token — checkout, a CLI that reads Actions, a
55
+ * fallback path — has what it needs instead of failing with a 403 that looks
56
+ * like a bot bug.
57
+ *
58
+ * `contents` varies: a review must never be able to push, so its workflow is
59
+ * read-only on purpose. That is defence in depth behind the bot's own guard.
60
+ */
61
+ export declare function workflowPermissions(options: {
62
+ contents: "read" | "write";
63
+ }): string;
64
+ export declare const APP_CREDENTIAL_WITH: string;
65
+ /**
66
+ * The one workflow the installer writes into a repository.
67
+ *
68
+ * A single file, because every event shares the same runner, the same checkout
69
+ * and the same action: five files meant five copies of that boilerplate, five
70
+ * places to update, and five chances to disagree. GitHub bills per job, not per
71
+ * file, so one workflow with one job and one event matrix spends exactly the
72
+ * same minutes and is far easier to reason about.
73
+ *
74
+ * Every trigger is on the default branch or on a pull request that targets it.
75
+ * Work on a side branch costs nothing until it becomes a pull request.
42
76
  */
43
77
  export interface WorkflowFile {
44
78
  path: string;
@@ -52,4 +86,3 @@ export declare function workflowTemplates(options: {
52
86
  actionRef?: string;
53
87
  stack?: Stack;
54
88
  }): WorkflowFile[];
55
- export declare function repoFromEnvOr(o?: RepoRef): RepoRef;
package/dist/detect.js CHANGED
@@ -1,4 +1,3 @@
1
- import { repoFromEnv } from "./github.js";
2
1
  /**
3
2
  * Lexically sniff the repository root. This is what makes the bot work in any
4
3
  * repository without being told the language: the prompt and the default
@@ -101,177 +100,141 @@ export async function detect(github, ref) {
101
100
  const installed = workflows.some((file) => file.name === "opencode-review.yml" || file.name === "opencode.yml");
102
101
  return { repo: info, stack, workflows, installed };
103
102
  }
103
+ /**
104
+ * The whole point of the app is that the bot acts as itself, not as the
105
+ * repository's `GITHUB_TOKEN`. A `permissions:` block also *caps*
106
+ * `GITHUB_TOKEN`, which is a separate credential, so both exist side by side:
107
+ * the app token does the writing, and `GITHUB_TOKEN` keeps a narrow read scope
108
+ * for anything else a step might touch.
109
+ *
110
+ * The action mints the installation token on every run, so what travels in the
111
+ * repository secrets is the app id and private key, never a token that would
112
+ * expire within the hour.
113
+ */
114
+ /**
115
+ * The `permissions:` block written into every workflow.
116
+ *
117
+ * This caps `GITHUB_TOKEN`, a credential separate from the app's installation
118
+ * token. The app token does the writing; this block exists so that anything a
119
+ * step does with the default token — checkout, a CLI that reads Actions, a
120
+ * fallback path — has what it needs instead of failing with a 403 that looks
121
+ * like a bot bug.
122
+ *
123
+ * `contents` varies: a review must never be able to push, so its workflow is
124
+ * read-only on purpose. That is defence in depth behind the bot's own guard.
125
+ */
126
+ export function workflowPermissions(options) {
127
+ return [
128
+ ` contents: ${options.contents}`,
129
+ // Every scope the bot has ever needed, plus the ones GitHub requires for the
130
+ // related operations. A missing scope is not a graceful failure: the run
131
+ // dies with a 403 that looks like a bug in the bot, and the cause is a line
132
+ // in a generated workflow nobody thinks to check.
133
+ " pull-requests: write",
134
+ " issues: write",
135
+ " checks: write",
136
+ " statuses: write",
137
+ " deployments: write",
138
+ " discussions: write",
139
+ " packages: write",
140
+ " actions: write",
141
+ " attestations: write",
142
+ " id-token: write",
143
+ " pages: write",
144
+ " security-events: write",
145
+ " models: read",
146
+ ].join("\n");
147
+ }
148
+ export const APP_CREDENTIAL_WITH = [
149
+ ` app-id: \${{ secrets.OPENCODE_APP_ID }}`,
150
+ ` app-private-key: \${{ secrets.OPENCODE_APP_PRIVATE_KEY }}`,
151
+ ].join("\n");
104
152
  export function workflowTemplates(options) {
105
153
  const actionRef = options.actionRef ?? "v0";
106
154
  const configRef = options.configRef ?? "main";
107
- const model = options.model ?? "free-pi/deepseek-v4.1-flash#max";
108
155
  const plugins = options.plugins ?? "@eduardo191labs/opencode-free-pi@latest";
109
156
  const common = ` config-repo: ${options.configRepo}
110
157
  config-ref: ${configRef}
111
158
  plugins: '${plugins}'`;
112
- const watchdog = `concurrency:
113
- group: opencode-\${{ github.workflow }}-\${{ github.ref }}
114
- cancel-in-progress: true
115
- `;
159
+ // Two ways in, one job.
160
+ //
161
+ // - `repository_dispatch` of type `bot-event`: the Cloudflare Worker in
162
+ // `webhook/` already received the event, decided it was worth a runner and
163
+ // forwarded the payload. This path exists so the decision happens before a
164
+ // runner is allocated.
165
+ // - The native triggers remain for a deployment without the worker. Each is
166
+ // limited to the default branch or a pull request targeting it, so
167
+ // side-branch work costs nothing.
168
+ //
169
+ // There is exactly one job, so one runner per accepted event, and no step that
170
+ // re-implements what the CLI already does: the payload file is handed straight
171
+ // to the action, which unwraps the forwarded shape.
116
172
  return [
117
173
  {
118
- path: ".github/workflows/opencode-review.yml",
119
- content: `name: OpenCode Review
174
+ path: ".github/workflows/opencode.yml",
175
+ content: `name: OpenCode
120
176
  on:
177
+ repository_dispatch:
178
+ types: [bot-event]
121
179
  pull_request:
180
+ branches: [main, master]
122
181
  types: [opened, synchronize, reopened, ready_for_review]
123
-
124
- permissions:
125
- contents: read
126
- pull-requests: write
127
- issues: write
128
-
129
- ${watchdog}
130
- jobs:
131
- review:
132
- if: github.event.pull_request.draft == false
133
- runs-on: ubuntu-latest
134
- steps:
135
- - uses: actions/checkout@v4
136
- with:
137
- fetch-depth: 0
138
- ref: \${{ github.event.pull_request.head.sha }}
139
- - uses: eduardo191-star/opencode-actions@${actionRef}
140
- with:
141
- event: pull_request
142
- github-token: \${{ secrets.GITHUB_TOKEN }}
143
- ${common}
144
- env:
145
- FREEPI_JWT: \${{ secrets.FREEPI_JWT }}
146
- `,
147
- },
148
- {
149
- path: ".github/workflows/opencode-commands.yml",
150
- content: `name: OpenCode Commands
151
- on:
152
182
  issue_comment:
153
183
  types: [created]
154
-
155
- permissions:
156
- contents: write
157
- pull-requests: write
158
- issues: write
159
-
160
- ${watchdog}
161
- jobs:
162
- command:
163
- if: |
164
- startsWith(github.event.comment.body, '/bot') ||
165
- contains(github.event.comment.body, '\\n/bot')
166
- runs-on: ubuntu-latest
167
- steps:
168
- - uses: actions/checkout@v4
169
- with:
170
- ref: \${{ github.event.issue.pull_request && format('refs/pull/{0}/head', github.event.issue.number) || github.event.repository.default_branch }}
171
- fetch-depth: 0
172
- - uses: eduardo191-star/opencode-actions@${actionRef}
173
- with:
174
- event: issue_comment
175
- github-token: \${{ secrets.GITHUB_TOKEN }}
176
- ${common}
177
- env:
178
- FREEPI_JWT: \${{ secrets.FREEPI_JWT }}
179
- `,
180
- },
181
- {
182
- path: ".github/workflows/opencode-commits.yml",
183
- content: `name: OpenCode Commits
184
- on:
185
- push:
186
- branches: [main, master]
187
-
188
- permissions:
189
- contents: read
190
- issues: write
191
-
192
- jobs:
193
- commits:
194
- if: github.event.deleted == false
195
- runs-on: ubuntu-latest
196
- steps:
197
- - uses: actions/checkout@v4
198
- with:
199
- fetch-depth: 0
200
- - uses: eduardo191-star/opencode-actions@${actionRef}
201
- with:
202
- event: push
203
- github-token: \${{ secrets.GITHUB_TOKEN }}
204
- ${common}
205
- env:
206
- FREEPI_JWT: \${{ secrets.FREEPI_JWT }}
207
- `,
208
- },
209
- {
210
- path: ".github/workflows/opencode-comments.yml",
211
- content: `name: OpenCode Comments
212
- on:
213
184
  pull_request_review_comment:
214
185
  types: [created]
186
+ issues:
187
+ types: [opened]
188
+ workflow_run:
189
+ workflows: ["*"]
190
+ types: [completed]
215
191
 
216
192
  permissions:
217
- contents: write
218
- pull-requests: write
219
- issues: write
193
+ ${workflowPermissions({ contents: "write" })}
194
+
195
+ concurrency:
196
+ # One run per pull request or issue thread; a newer one replaces the older.
197
+ group: opencode-\${{ github.event.client_payload.payload.pull_request.number || github.event.pull_request.number || github.event.issue.number || github.run_id }}
198
+ cancel-in-progress: true
220
199
 
221
- ${watchdog}
222
200
  jobs:
223
- comment:
224
- if: |
225
- contains(github.event.comment.body, '/bot') ||
226
- contains(github.event.comment.body, '/oc') ||
227
- contains(github.event.comment.body, '@opencode')
201
+ bot:
202
+ name: \${{ github.event.client_payload.event || github.event_name }}
228
203
  runs-on: ubuntu-latest
204
+ # A draft is not ready, a bot comment is not a request, a successful run
205
+ # needs no autofix. The worker filters most of this; repeating it keeps a
206
+ # deployment without the worker behaving the same.
207
+ if: |
208
+ github.event_name == 'repository_dispatch' ||
209
+ (github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
210
+ (github.event_name == 'issue_comment' && github.event.comment.user.type != 'Bot') ||
211
+ (github.event_name == 'pull_request_review_comment' && github.event.comment.user.type != 'Bot') ||
212
+ github.event_name == 'issues' ||
213
+ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.name != 'OpenCode')
229
214
  steps:
230
215
  - uses: actions/checkout@v4
231
216
  with:
232
- ref: \${{ github.event.pull_request.head.sha }}
217
+ ref: \${{ github.event.client_payload.payload.pull_request.head.sha || github.event.client_payload.payload.workflow_run.head_sha || github.event.pull_request.head.sha || github.event.issue.pull_request && format('refs/pull/{0}/head', github.event.issue.number) || github.event.workflow_run.head_sha || github.event.repository.default_branch }}
233
218
  fetch-depth: 0
234
- - uses: eduardo191-star/opencode-actions@${actionRef}
235
- with:
236
- event: pull_request_review_comment
237
- github-token: \${{ secrets.GITHUB_TOKEN }}
238
- ${common}
239
- env:
240
- FREEPI_JWT: \${{ secrets.FREEPI_JWT }}
241
- `,
242
- },
243
- {
244
- path: ".github/workflows/opencode-issues.yml",
245
- content: `name: OpenCode Issues
246
- on:
247
- issues:
248
- types: [opened, reopened]
249
219
 
250
- permissions:
251
- contents: write
252
- pull-requests: write
253
- issues: write
220
+ # The forwarded payload is written to a file so the CLI reads one shape
221
+ # from one path. It unwraps \`{ event, payload }\` itself.
222
+ - name: Write the forwarded payload
223
+ if: github.event_name == 'repository_dispatch'
224
+ env:
225
+ FORWARDED: \${{ toJSON(github.event.client_payload) }}
226
+ run: printf '%s' "$FORWARDED" > "$RUNNER_TEMP/event.json"
254
227
 
255
- jobs:
256
- triage:
257
- if: github.event.issue.author_association != 'NONE'
258
- runs-on: ubuntu-latest
259
- steps:
260
- - uses: actions/checkout@v4
261
- with:
262
- fetch-depth: 0
263
228
  - uses: eduardo191-star/opencode-actions@${actionRef}
264
229
  with:
265
- event: issues
266
- mode: issues
230
+ event: \${{ github.event.client_payload.event || github.event_name }}
267
231
  github-token: \${{ secrets.GITHUB_TOKEN }}
232
+ payload: \${{ github.event_name == 'repository_dispatch' && format('{0}/event.json', runner.temp) || github.event_path }}
268
233
  ${common}
234
+ ${APP_CREDENTIAL_WITH}
269
235
  env:
270
236
  FREEPI_JWT: \${{ secrets.FREEPI_JWT }}
271
237
  `,
272
238
  },
273
239
  ];
274
240
  }
275
- export function repoFromEnvOr(o) {
276
- return o ?? repoFromEnv();
277
- }
package/dist/format.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { BotConfig } from "./config.js";
2
2
  declare const SEVERITY_ORDER: readonly ["critical", "high", "medium", "low", "info"];
3
3
  export type Severity = (typeof SEVERITY_ORDER)[number];
4
+ /** The plain-language name for the scale: critical, high, medium, low, info. */
5
+ export type SemanticSeverity = Severity;
4
6
  export declare function severityRank(severity: string): number;
5
7
  export interface Finding {
6
8
  path: string;
@@ -18,7 +20,7 @@ export interface ReviewResult {
18
20
  }
19
21
  export declare function header(config: BotConfig, subtitle?: string): string;
20
22
  export declare function badge(severity: Severity): "🟥 **critical**" | "🟧 **high**" | "🟨 **medium**" | "🟦 **low**" | "⬜ **info**";
21
- export declare function verdictLine(verdict: ReviewResult["verdict"]): "✅ **Approved** — no blocking issues found." | "🚧 **Changes requested** — see the findings below." | "💬 **Review complete** — comments below are non-blocking.";
23
+ export declare function verdictLine(verdict: ReviewResult["verdict"]): "✅ **Nothing blocking** — no findings worth holding the merge for." | "🚧 **Worth fixing before merge** — suggestions are inline, nothing is blocked." | "💬 **Review complete** — comments below are non-blocking.";
22
24
  export declare function reviewSummaryBody(config: BotConfig, review: ReviewResult, meta: {
23
25
  model?: string;
24
26
  cost?: number;
package/dist/format.js CHANGED
@@ -26,9 +26,12 @@ export function badge(severity) {
26
26
  export function verdictLine(verdict) {
27
27
  switch (verdict) {
28
28
  case "APPROVE":
29
- return "✅ **Approved** — no blocking issues found.";
29
+ return "✅ **Nothing blocking** — no findings worth holding the merge for.";
30
30
  case "REQUEST_CHANGES":
31
- return "🚧 **Changes requested** — see the findings below.";
31
+ // The review is always posted as COMMENT, so nothing here blocks a merge.
32
+ // Saying "changes requested" would describe a state the pull request is
33
+ // not in, and read as a gate the bot does not have.
34
+ return "🚧 **Worth fixing before merge** — suggestions are inline, nothing is blocked.";
32
35
  default:
33
36
  return "💬 **Review complete** — comments below are non-blocking.";
34
37
  }
package/dist/git.d.ts CHANGED
@@ -22,6 +22,22 @@ export declare function assertWorkflowWrites(config: BotConfig, files: string[])
22
22
  export declare function assertBranchWrites(config: BotConfig, branch: string): void;
23
23
  export declare function assertFileCount(config: BotConfig, files: string[], limit?: number): void;
24
24
  export declare function configureIdentity(cwd: string, config: BotConfig): Promise<void>;
25
+ /**
26
+ * The marker that keeps a bot commit from triggering the bot.
27
+ *
28
+ * Every commit made from a workflow is pushed with the workflow's token, and
29
+ * GitHub does not start a new workflow run for an `GITHUB_TOKEN` push — but it
30
+ * *does* start one when the run is dispatched by the app, and it always starts
31
+ * one for a pull request branch. Without a marker, each commit the bot makes can
32
+ * start the workflow that made it, and the repository spins.
33
+ *
34
+ * `[skip ci]` is GitHub's own opt-out and is respected by every workflow, which
35
+ * is why it is used instead of a private convention: a repository with its own
36
+ * CI gets the same protection without being told.
37
+ */
38
+ export declare const SKIP_CI = "[skip ci]";
39
+ /** True when a commit is one the bot made, and so must not re-trigger it. */
40
+ export declare function isBotCommit(message: string): boolean;
25
41
  export declare function commitAll(cwd: string, message: string, config: BotConfig): Promise<{
26
42
  sha: string;
27
43
  files: string[];
package/dist/git.js CHANGED
@@ -73,6 +73,24 @@ export async function configureIdentity(cwd, config) {
73
73
  await git(cwd, ["config", "user.name", `${name}[bot]`]);
74
74
  await git(cwd, ["config", "user.email", `${name}-bot@users.noreply.github.com`]);
75
75
  }
76
+ /**
77
+ * The marker that keeps a bot commit from triggering the bot.
78
+ *
79
+ * Every commit made from a workflow is pushed with the workflow's token, and
80
+ * GitHub does not start a new workflow run for an `GITHUB_TOKEN` push — but it
81
+ * *does* start one when the run is dispatched by the app, and it always starts
82
+ * one for a pull request branch. Without a marker, each commit the bot makes can
83
+ * start the workflow that made it, and the repository spins.
84
+ *
85
+ * `[skip ci]` is GitHub's own opt-out and is respected by every workflow, which
86
+ * is why it is used instead of a private convention: a repository with its own
87
+ * CI gets the same protection without being told.
88
+ */
89
+ export const SKIP_CI = "[skip ci]";
90
+ /** True when a commit is one the bot made, and so must not re-trigger it. */
91
+ export function isBotCommit(message) {
92
+ return message.includes(SKIP_CI);
93
+ }
76
94
  export async function commitAll(cwd, message, config) {
77
95
  const owner = await state(cwd);
78
96
  if (!owner.dirty)
@@ -80,7 +98,11 @@ export async function commitAll(cwd, message, config) {
80
98
  assertWorkflowWrites(config, owner.changedFiles);
81
99
  await configureIdentity(cwd, config);
82
100
  const trailer = bot(config).commit_trailer;
83
- const full = trailer ? `${message}\n\n${trailer}` : message;
101
+ // The marker goes on the subject line, where GitHub reads it. A trailer is
102
+ // still honoured, but it is not a reliable place to put `[skip ci]`.
103
+ const subject = message.split("\n")[0] ?? message;
104
+ const first = isBotCommit(subject) ? message : `${subject} ${SKIP_CI}${message.slice(subject.length)}`;
105
+ const full = trailer ? `${first}\n\n${trailer}` : first;
84
106
  await git(cwd, ["add", "-A"]);
85
107
  const result = await git(cwd, ["commit", "-m", full]);
86
108
  if (result.code !== 0)
package/dist/github.d.ts CHANGED
@@ -69,7 +69,11 @@ export declare class GitHub {
69
69
  commit_title?: string;
70
70
  commit_message?: string;
71
71
  merge_method?: "merge" | "squash" | "rebase";
72
- }): Promise<unknown>;
72
+ }): Promise<{
73
+ merged: boolean;
74
+ sha: string;
75
+ message?: string;
76
+ }>;
73
77
  /** Create a review, optionally with inline comments and a request-changes verdict. */
74
78
  createReview(ref: RepoRef, number: number, input: {
75
79
  body?: string;
@@ -154,6 +158,10 @@ export interface PullRequest {
154
158
  changed_files: number;
155
159
  additions: number;
156
160
  deletions: number;
161
+ /** Null while GitHub is still computing it. */
162
+ mergeable?: boolean | null;
163
+ mergeable_state?: string;
164
+ merge_commit_sha?: string | null;
157
165
  }
158
166
  export interface PullFile {
159
167
  filename: string;
@@ -0,0 +1,116 @@
1
+ /**
2
+ * The Copilot workflow: an issue becomes a working branch and a pull request
3
+ * that keeps being edited until it is merged.
4
+ *
5
+ * The shape matters. Copilot's value is not that it writes a patch once; it is
6
+ * that the patch lives on a branch where the author can ask for another pass,
7
+ * commit to it, and merge it when it is right. This module keeps that state in
8
+ * the pull request itself rather than in the runner, because a run is over in
9
+ * minutes and the conversation is not.
10
+ *
11
+ * Everything here is opt-in through permissions: creating a branch needs
12
+ * `manage_branches`, editing a PR needs `manage_pull_requests`, merging needs
13
+ * `merge_pull_requests` (or `merge_protected` on a protected base).
14
+ */
15
+ import { type BotConfig } from "./config.js";
16
+ import type { GitHub, RepoRef } from "./github.js";
17
+ export interface WorkBranch {
18
+ /** Branch name derived from the issue, stable across runs. */
19
+ branch: string;
20
+ /** The pull request, when one is already open for the branch. */
21
+ pr: number | null;
22
+ }
23
+ /**
24
+ * A branch name that identifies the issue and survives a second run.
25
+ *
26
+ * Stable matters: a follow-up command must commit onto the *same* branch, or
27
+ * the author ends up with four pull requests for one issue. The issue number is
28
+ * the only part that cannot change, so it leads.
29
+ */
30
+ export declare function workBranch(config: BotConfig, issueNumber: number, title: string): string;
31
+ /**
32
+ * The commit trailer that ties a branch back to its issue.
33
+ *
34
+ * Used instead of a runner-side store: the branch and the PR are durable, the
35
+ * runner is not. It is also how a later run finds the issue without being told.
36
+ */
37
+ export declare function issueTrailer(issueNumber: number): string;
38
+ /** Extract the issue a branch or PR belongs to, from a name or a trailer. */
39
+ export declare function issueFromText(text: string): number | null;
40
+ export interface ImplementOptions {
41
+ issueNumber: number;
42
+ title: string;
43
+ body: string;
44
+ /** Run id or comment id, so a reply can be posted where the request was made. */
45
+ requestId?: number;
46
+ }
47
+ /**
48
+ * Create or reuse the working branch, let the agent write the change, and open a
49
+ * PR whose body is generated from the actual diff.
50
+ *
51
+ * Reuse is the point: `implement` on an issue twice must not produce two
52
+ * branches. The existing branch is checked out by name on the base and the agent
53
+ * works on top of it.
54
+ */
55
+ export declare function implementIssue(ctx: {
56
+ github: GitHub;
57
+ repo: RepoRef;
58
+ config: BotConfig;
59
+ workspace: string;
60
+ log: (message: string) => void;
61
+ }, options: ImplementOptions, run: (prompt: string) => Promise<{
62
+ text: string;
63
+ resultJson: any;
64
+ model?: string;
65
+ cost?: number;
66
+ }>): Promise<{
67
+ rejected: string;
68
+ unchanged?: undefined;
69
+ branch?: undefined;
70
+ pr?: undefined;
71
+ text?: undefined;
72
+ updated?: undefined;
73
+ model?: undefined;
74
+ cost?: undefined;
75
+ } | {
76
+ unchanged: boolean;
77
+ branch: string;
78
+ pr: any;
79
+ text: string;
80
+ rejected?: undefined;
81
+ updated?: undefined;
82
+ model?: undefined;
83
+ cost?: undefined;
84
+ } | {
85
+ unchanged: boolean;
86
+ branch: string;
87
+ rejected?: undefined;
88
+ pr?: undefined;
89
+ text?: undefined;
90
+ updated?: undefined;
91
+ model?: undefined;
92
+ cost?: undefined;
93
+ } | {
94
+ branch: string;
95
+ pr: any;
96
+ updated: boolean;
97
+ model: string | undefined;
98
+ cost: number | undefined;
99
+ rejected?: undefined;
100
+ unchanged?: undefined;
101
+ text?: undefined;
102
+ } | {
103
+ branch: string;
104
+ pr: number;
105
+ model: string | undefined;
106
+ cost: number | undefined;
107
+ rejected?: undefined;
108
+ unchanged?: undefined;
109
+ text?: undefined;
110
+ updated?: undefined;
111
+ }>;
112
+ /** The PR a branch already has open, if any. */
113
+ export declare function findPullForBranch(github: GitHub, repo: RepoRef, branch: string): Promise<{
114
+ number: any;
115
+ url: any;
116
+ } | null>;