(args: string[])
| 40 | */ |
| 41 | export async function runSubscriptionCommands(gh: GhRunner, prUrl: string): Promise<string> { |
| 42 | const expect = async (args: string[]) => { |
| 43 | const result = await gh(args); |
| 44 | if (result.code !== 0) throw new Error(`gh ${args.join(" ")} exited ${result.code}: ${result.stderr.trim()}`); |
| 45 | return result.stdout; |
| 46 | }; |
| 47 | const type = "com.github.pull_request.merge_conflict.v1"; |
| 48 | const id = (await expect(["event", "subscription", "create", "--resource", prUrl, "--event", type])).trim(); |
| 49 | if (!/^sub_[A-Za-z0-9]+$/.test(id)) throw new Error(`gh event subscription create printed no subscription ID: ${id}`); |
no test coverage detected