@idea1/cli 1.10.0 → 1.10.1
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/README.md +7 -7
- package/dist/commands/approve-pr.d.ts.map +1 -1
- package/dist/commands/approve-pr.js +1 -54
- package/dist/commands/approve-pr.js.map +1 -1
- package/dist/commands/ready-for-approval.d.ts.map +1 -1
- package/dist/commands/ready-for-approval.js +1 -79
- package/dist/commands/ready-for-approval.js.map +1 -1
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +5 -8
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/ship-local-changes.d.ts +2 -0
- package/dist/commands/ship-local-changes.d.ts.map +1 -1
- package/dist/commands/ship-local-changes.js +30 -5
- package/dist/commands/ship-local-changes.js.map +1 -1
- package/dist/services/github.d.ts +25 -7
- package/dist/services/github.d.ts.map +1 -1
- package/dist/services/github.js +23 -9
- package/dist/services/github.js.map +1 -1
- package/dist/workflow/engine/approval-flow.d.ts +18 -0
- package/dist/workflow/engine/approval-flow.d.ts.map +1 -1
- package/dist/workflow/engine/approval-flow.js +122 -2
- package/dist/workflow/engine/approval-flow.js.map +1 -1
- package/dist/workflow/engine/release-engine.d.ts +16 -5
- package/dist/workflow/engine/release-engine.d.ts.map +1 -1
- package/dist/workflow/engine/release-engine.js +80 -8
- package/dist/workflow/engine/release-engine.js.map +1 -1
- package/dist/workflow/engine/ship-flow.d.ts +10 -0
- package/dist/workflow/engine/ship-flow.d.ts.map +1 -1
- package/dist/workflow/engine/ship-flow.js +70 -13
- package/dist/workflow/engine/ship-flow.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -172,7 +172,7 @@ With `--approve-and-merge`, the item is then advanced through every workflow sta
|
|
|
172
172
|
|
|
173
173
|
### ship-local-changes
|
|
174
174
|
|
|
175
|
-
`start --carry-local-changes --approve-and-merge` as one unattended command: create a project item, cut its branch from `working/release`, commit and push your uncommitted changes there, advance it to Needs Approval for Release assigned to you, with a PR assigned to you, wait for the PR's checks and merge it into `working/release`. You end on `working/release`, clean, with your changes merged. The only questions are the ones a new item needs (its title and Project) when they are not supplied.
|
|
175
|
+
`start --carry-local-changes --approve-and-merge` as one unattended command: create a project item, cut its branch from `working/release`, commit and push your uncommitted changes there, advance it to Needs Approval for Release assigned to you, with a PR assigned to you, wait for the PR's checks and merge it into `working/release`. You end on `working/release`, clean, with your changes merged. The only questions are the ones a new item needs (its title and Project) when they are not supplied. Leaving the title blank ships with no project item: the changes go onto a branch that gets a PR assigned to you, which merges once its checks pass, exactly as `ready-for-approval` and `approve-pr` treat a branch with no item, and no workflow status is recorded.
|
|
176
176
|
|
|
177
177
|
```bash
|
|
178
178
|
idea1 ship-local-changes --title "Release prep" --project "Omega"
|
|
@@ -183,10 +183,10 @@ idea1 ship --target <url> # an existing item whose branch has no commit
|
|
|
183
183
|
|
|
184
184
|
**Options:**
|
|
185
185
|
- `--target <url | branch | PR url>` - An existing project item (default: create a new one).
|
|
186
|
-
- `-t, --title <title>`, `-P, --project <name>` - The new item's title and Project (asked when
|
|
186
|
+
- `-t, --title <title>`, `-P, --project <name>` - The new item's title and Project (asked when no target is given; a blank title skips the item and the Project).
|
|
187
187
|
- `-n, --branch-name <name>` - Branch name under the branch prefix (default: derived from the item).
|
|
188
188
|
- `-b, --base-branch <branch>` - The branch your checkout is on, which the item's branch is cut from and merges into (default: `baseBranch`).
|
|
189
|
-
- `-M, --commit-message <message>` - Commit message (default: the item's title).
|
|
189
|
+
- `-M, --commit-message <message>` - Commit message (default: the item's title; with no item, a generic message naming the base branch).
|
|
190
190
|
- `-iso, --isolation <mode>` - `worktree` (default, never asked) works on the branch in a worktree while it is shipped and leaves your checkout on `working/release`; `main-repo` switches your checkout to the branch until the merge, then back.
|
|
191
191
|
- `-r, --reviewers <user1,user2>` - Reviewers to request on the PR (optional).
|
|
192
192
|
|
|
@@ -420,8 +420,8 @@ idea1 r
|
|
|
420
420
|
- `-y, --yes` - In `merge` mode, merge without asking for confirmation; with `--target`, also start the approvals without asking. The required checks still gate every merge
|
|
421
421
|
|
|
422
422
|
**What it does:**
|
|
423
|
-
1. Requires you to be on the release branch with nothing uncommitted, unpushed or behind origin
|
|
424
|
-
2. Bumps versions, when the repository's `.idea1/settings.json` has a `release` section (see [Release Settings](#release-settings)). A versioned package needs a bump when its folder differs between the release branch and the target and its `package.json` version is still the same on both — so a release re-run after a bump never bumps twice. You pick `patch`, `minor` or `major` for each such package (or give them with `--bumps`), and are asked nothing when no package changed. The CLI makes the bump itself, in your checkout, with no script or workflow: it sets the new version in each package's `package.json` and in the lockfiles at or above the package's folder that record it (the same files `npm version` touches, edited in place so nothing else changes), commits them as one `chore: bump <package> <version>, ...` commit and pushes it to the release branch. Only plain `major.minor.patch` versions are bumped. The bump lands before the PR is opened, so its commit is the PR's head and the suite runs once, on the release as it will merge.
|
|
423
|
+
1. Requires you to be on the release branch with nothing uncommitted, unpushed or behind origin, and to have write access to the repository. Refuses when a PR from the release branch into the target is already open: one that does not follow the release workflow (it has no assignee, or its description carries no approval chain) has to be fixed in GitHub or closed, and a release PR is approved with `--approve` instead. The Idea1 web app refuses a release on the same terms
|
|
424
|
+
2. Bumps versions, when the repository's `.idea1/settings.json` has a `release` section (see [Release Settings](#release-settings)). A versioned package needs a bump when its folder differs between the release branch and the target and its `package.json` version is still the same on both — so a release re-run after a bump never bumps twice. You pick `patch`, `minor` or `major` for each such package (or give them with `--bumps`), and are asked nothing when no package changed. The CLI makes the bump itself, in your checkout, with no script or workflow: it sets the new version in each package's `package.json` and in the lockfiles at or above the package's folder that record it (the same files `npm version` touches, edited in place so nothing else changes), commits them as one `chore: bump <package> <version>, ...` commit and pushes it to the release branch. Only plain `major.minor.patch` versions are bumped. The bump lands before the PR is opened, so its commit is the PR's head and the suite runs once, on the release as it will merge. The Idea1 web app's release view makes the same bump through the GitHub API
|
|
425
425
|
3. Creates the release PR assigned to you, whose body is the release's approval chain: every contained PR — attributed by GitHub's commit association, so squash and rebase merges are covered — with its author and the assignee who approved it by merging. Commits with no PR are listed separately, split in two: the version bumps (a commit with no PR that changes only version files, meaning the `package.json` of a declared package and the lockfiles above it, whatever its name or author), which are release automation and not an exception, and genuine direct commits, which are exceptions under change-management-policy.md clause 2, explained at the quarterly review
|
|
426
426
|
4. Refuses the release when nothing in it came through a merged PR. A repository admin can override that — an explicit confirmation and a required reason — and the exception is recorded as a comment on the PR naming the admin, the reason and every commit that had no PR, as well as in the PR body. Anyone who is not a repository admin just gets the refusal
|
|
427
427
|
5. In `merge` mode, enables auto-merge, or waits for the required CI/CD checks and merges normally. Checks that fail, never start or never finish stop the release; an admin override is available but takes an explicit confirmation and a required reason, and the exception is recorded as a comment on the PR before anything is merged
|
|
@@ -431,7 +431,7 @@ idea1 r
|
|
|
431
431
|
|
|
432
432
|
`idea1 release --target <items, branches or PRs>` releases the release branch once the given targets are approved into it, as one unattended sequence:
|
|
433
433
|
|
|
434
|
-
1. **Checks:** your checkout must be on the release branch, clean and level with origin. Then every target is resolved exactly as `approve-pr` resolves several targets.
|
|
434
|
+
1. **Checks:** your checkout must be on the release branch, clean and level with origin, and the release must be one that can be created (see step 1 above). Then every target is resolved exactly as `approve-pr` resolves several targets.
|
|
435
435
|
2. **Questions, all asked up front:**
|
|
436
436
|
- the options the targets' workflow states need, then one confirmation of the approvals;
|
|
437
437
|
- the version bump of every versioned package changed on the release branch or on any target's branch;
|
|
@@ -447,7 +447,7 @@ In interactive mode the whole sequence runs as a background job (see `/jobs`); o
|
|
|
447
447
|
|
|
448
448
|
#### Approving an open release
|
|
449
449
|
|
|
450
|
-
`idea1 release --approve` finds the open release PR from the release branch into the target and merges it as its approver,
|
|
450
|
+
`idea1 release --approve` finds the open release PR from the release branch into the target and merges it as its approver, on the same terms as the Idea1 web app: you need write access to the repository, the PR must follow the release workflow (an assignee, and the approval chain as its description), and you must be one of its assignees — anyone else is refused, and the PR is reassigned in GitHub or approved by its assignee. Then:
|
|
451
451
|
- every check passed — merges now
|
|
452
452
|
- checks still running — enables auto-merge, or waits for the checks and merges where GitHub can't auto-merge
|
|
453
453
|
- a check failed — stops, unless a repository admin confirms the admin override, gives a reason, and has it recorded on the PR before the merge
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approve-pr.d.ts","sourceRoot":"","sources":["../../src/commands/approve-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"approve-pr.d.ts","sourceRoot":"","sources":["../../src/commands/approve-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAOjD,eAAO,MAAM,gBAAgB,EAAE,OA0B9B,CAAC"}
|
|
@@ -1,61 +1,8 @@
|
|
|
1
|
-
import { logger } from '../lib/logger.js';
|
|
2
|
-
import { readBranchSettings } from '../lib/settings.js';
|
|
3
|
-
import * as git from '../services/git.js';
|
|
4
|
-
import * as github from '../services/github.js';
|
|
5
|
-
import * as worktree from '../services/worktree.js';
|
|
6
1
|
import { WorkflowStates } from '../workflow/data/workflow-states.js';
|
|
7
|
-
import {
|
|
8
|
-
import { confirmApproverIdentity } from '../workflow/engine/release-engine.js';
|
|
2
|
+
import { approvePrOnBranchWithNoItem, mergeConfirmationOption } from '../workflow/engine/approval-flow.js';
|
|
9
3
|
import { advanceAsNeededTo, resolveTarget } from '../workflow/engine/workflow-engine.js';
|
|
10
4
|
import { runForTargets, targetOption } from '../jobs/targets.js';
|
|
11
5
|
import { deferredHandlerOptions } from '../workflow/engine/handlers/index.js';
|
|
12
|
-
/**
|
|
13
|
-
* Stage 1 approval for a branch with no project item: the assignee merges the branch's PR once
|
|
14
|
-
* the required checks pass (no override), then the branch is cleaned up. No workflow status is
|
|
15
|
-
* recorded. The branch need not be checked out - the assignee can approve from anywhere.
|
|
16
|
-
*/
|
|
17
|
-
async function approvePrOnBranchWithNoItem(branchName, confirmed) {
|
|
18
|
-
await github.ensureGitHubCli();
|
|
19
|
-
// Captured before anything moves: cleanup may switch branches or remove a worktree.
|
|
20
|
-
const workingPath = await git.getCheckoutPathForBranch(branchName);
|
|
21
|
-
const prInfo = await github.getPrInfo(branchName);
|
|
22
|
-
if (!prInfo) {
|
|
23
|
-
throw new Error(`No PR found for ${branchName}. Run idea1 ready-for-approval --target ${branchName} first to open it and name its approver.`);
|
|
24
|
-
}
|
|
25
|
-
logger.info(`PR #${prInfo.number} found`);
|
|
26
|
-
const state = prInfo.state.toUpperCase();
|
|
27
|
-
if (state === 'CLOSED') {
|
|
28
|
-
throw new Error(`PR #${prInfo.number} is closed without being merged; there is nothing to approve.`);
|
|
29
|
-
}
|
|
30
|
-
const baseBranch = prInfo.baseRefName ?? await worktree.resolveBaseBranch();
|
|
31
|
-
const releaseTargetBranch = (await readBranchSettings(await git.getRepoRoot())).releaseTargetBranch;
|
|
32
|
-
if (baseBranch === releaseTargetBranch) {
|
|
33
|
-
throw new Error(`PR #${prInfo.number} targets ${releaseTargetBranch}: that is a release, not a change to approve. ` +
|
|
34
|
-
'Use idea1 release for it (change-management-policy.md clause 2).');
|
|
35
|
-
}
|
|
36
|
-
logger.header(`Approve: ${branchName} -> ${baseBranch}`);
|
|
37
|
-
logger.info('This branch has no project item, so no workflow status is recorded.');
|
|
38
|
-
logger.newline();
|
|
39
|
-
if (state === 'MERGED') {
|
|
40
|
-
logger.dim(`PR #${prInfo.number} is already merged; cleaning up the branch.`);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
if (workingPath) {
|
|
44
|
-
await git.ensureBranchUpToDate();
|
|
45
|
-
}
|
|
46
|
-
// Merging retires the branch, which would orphan any PR still targeting it.
|
|
47
|
-
const openPrsInto = await github.listOpenPrsInto(branchName);
|
|
48
|
-
if (openPrsInto.length > 0) {
|
|
49
|
-
const list = openPrsInto.map(pr => ` #${pr.number} ${pr.headRefName} ${pr.title}`).join('\n');
|
|
50
|
-
throw new Error(`${openPrsInto.length} open PR(s) still target ${branchName}; approve or close them before approving this branch:\n${list}`);
|
|
51
|
-
}
|
|
52
|
-
await confirmApproverIdentity(branchName);
|
|
53
|
-
await mergeAsApprover({ branchName, baseBranch, prNumber: prInfo.number, confirmed });
|
|
54
|
-
}
|
|
55
|
-
await cleanUpMergedBranch({ branchName, baseBranch, workingPath });
|
|
56
|
-
logger.newline();
|
|
57
|
-
logger.success(`PR merged into ${baseBranch} - the merge is the recorded approval`);
|
|
58
|
-
}
|
|
59
6
|
export const approvePrCommand = {
|
|
60
7
|
name: 'approve-pr',
|
|
61
8
|
aliases: ['approve'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approve-pr.js","sourceRoot":"","sources":["../../src/commands/approve-pr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"approve-pr.js","sourceRoot":"","sources":["../../src/commands/approve-pr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAY;IACvC,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,WAAW,EAAE,8LAA8L;IAC3M,OAAO,EAAE;QACP,YAAY,CAAC,IAAI,CAAC;QAClB,4FAA4F;QAC5F,qEAAqE;QACrE,GAAG,sBAAsB,CAAC,EAAE,CAAC;KAC9B;IAED,KAAK,CAAC,OAAO,CAAC,QAAgC;QAC5C,MAAM,aAAa,CAAC,gBAAgB,EAAE,QAAQ,EAAE;YAC9C,UAAU,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,iBAAiB;YAClD,gBAAgB,EAAE,IAAI;YACtB,uBAAuB,EAAE,IAAI;YAC7B,GAAG,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;gBAClB,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAC1E,IAAI,cAAc,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBACnC,MAAM,iBAAiB,CAAC,cAAc,CAAC,UAAU,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;oBACrF,OAAO;gBACT,CAAC;gBACD,MAAM,2BAA2B,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAC,CAAC;YACtH,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ready-for-approval.d.ts","sourceRoot":"","sources":["../../src/commands/ready-for-approval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ready-for-approval.d.ts","sourceRoot":"","sources":["../../src/commands/ready-for-approval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAQjD,eAAO,MAAM,uBAAuB,EAAE,OA0CrC,CAAC"}
|
|
@@ -1,87 +1,9 @@
|
|
|
1
|
-
import { logger } from '../lib/logger.js';
|
|
2
|
-
import { promptInput, promptSelect } from '../lib/prompt.js';
|
|
3
|
-
import { readBranchSettings } from '../lib/settings.js';
|
|
4
1
|
import { WorkflowStates } from '../workflow/data/workflow-states.js';
|
|
5
|
-
import
|
|
6
|
-
import * as github from '../services/github.js';
|
|
7
|
-
import * as platform from '../services/platform.js';
|
|
8
|
-
import * as worktree from '../services/worktree.js';
|
|
9
|
-
import { approverGitHubLogin, assigneeOption, ensurePrReadyForApproval } from '../workflow/engine/approval-flow.js';
|
|
10
|
-
import { validateSourceBranch } from '../workflow/engine/release-engine.js';
|
|
2
|
+
import { readyForApprovalOnBranchWithNoItem, resolveApproverForBranch } from '../workflow/engine/approval-flow.js';
|
|
11
3
|
import { advanceOrReenter, resolveTarget } from '../workflow/engine/workflow-engine.js';
|
|
12
4
|
import { runForTargets, targetOption } from '../jobs/targets.js';
|
|
13
5
|
import { deferredHandlerOptions } from '../workflow/engine/handlers/index.js';
|
|
14
6
|
import { readyForApprovalHandler } from '../workflow/engine/handlers/ready-for-approval.js';
|
|
15
|
-
/**
|
|
16
|
-
* The teammate who approves a branch with no project item, as the `assignee` option (their email or
|
|
17
|
-
* GitHub login): asked from the team's members when not supplied. There is no item to assign; the
|
|
18
|
-
* teammate's linked GitHub account becomes the PR's assignee.
|
|
19
|
-
*/
|
|
20
|
-
async function resolveApproverForBranch(options) {
|
|
21
|
-
if ((options[assigneeOption.longName] ?? '').trim().length > 0) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const members = await platform.listTeamMembers();
|
|
25
|
-
options[assigneeOption.longName] = await promptSelect('Assign to a teammate (the assignee approves the pull request)', members.map(member => ({ label: member.email, value: member.email })));
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Stage 1 for a branch with no project item - an integration branch carrying approved work items,
|
|
29
|
-
* for instance: the PR into the base branch is opened when the branch has none, with the approval
|
|
30
|
-
* chain of what it carries as its body, and gets its assignee. No workflow status is recorded.
|
|
31
|
-
*/
|
|
32
|
-
async function readyForApprovalOnBranchWithNoItem(branchName, resolved) {
|
|
33
|
-
await github.ensureGitHubCli();
|
|
34
|
-
await resolveApproverForBranch(resolved);
|
|
35
|
-
const approver = approverGitHubLogin(await platform.resolveTeammate(resolved[assigneeOption.longName]));
|
|
36
|
-
const existingPr = await github.getPrInfo(branchName);
|
|
37
|
-
const openPr = existingPr && existingPr.state.toUpperCase() === 'OPEN' ? existingPr : null;
|
|
38
|
-
const requestedBase = resolved['base-branch'] || null;
|
|
39
|
-
const targetBranch = openPr?.baseRefName ?? requestedBase ?? await worktree.resolveBaseBranch();
|
|
40
|
-
if (openPr?.baseRefName && requestedBase && openPr.baseRefName !== requestedBase) {
|
|
41
|
-
logger.warning(`PR #${openPr.number} targets ${openPr.baseRefName}; --base-branch ${requestedBase} is ignored. Retarget the PR in GitHub if that is wrong.`);
|
|
42
|
-
}
|
|
43
|
-
if (branchName === targetBranch) {
|
|
44
|
-
throw new Error(`${targetBranch} is the branch changes are approved into, not a change to approve. Pass --target <the branch, item or PR to approve>.`);
|
|
45
|
-
}
|
|
46
|
-
const releaseTargetBranch = (await readBranchSettings(await git.getRepoRoot())).releaseTargetBranch;
|
|
47
|
-
if (targetBranch === releaseTargetBranch) {
|
|
48
|
-
throw new Error(`A change is approved into ${await worktree.resolveBaseBranch()}, never straight into ${releaseTargetBranch}; ` +
|
|
49
|
-
'use idea1 release for that (change-management-policy.md clause 2).');
|
|
50
|
-
}
|
|
51
|
-
logger.header(`Ready for approval: ${branchName} -> ${targetBranch}`);
|
|
52
|
-
logger.info('This branch has no project item, so no workflow status is recorded.');
|
|
53
|
-
logger.newline();
|
|
54
|
-
if (!await git.fetchRemoteBranch(branchName)) {
|
|
55
|
-
throw new Error(`Branch ${branchName} is not on origin. Push it first: git push -u origin ${branchName}`);
|
|
56
|
-
}
|
|
57
|
-
// A local checkout of the branch (the working directory, once the target is resolved) must
|
|
58
|
-
// carry exactly what origin has; a branch with no checkout here is what origin has.
|
|
59
|
-
if (await git.getCheckoutPathForBranch(branchName)) {
|
|
60
|
-
await validateSourceBranch(branchName);
|
|
61
|
-
}
|
|
62
|
-
const title = openPr ? '' : (resolved['title'] || await promptPrTitle(branchName));
|
|
63
|
-
await ensurePrReadyForApproval({
|
|
64
|
-
branchName,
|
|
65
|
-
baseBranch: targetBranch,
|
|
66
|
-
assignee: approver,
|
|
67
|
-
reviewers: resolved['reviewers'] ?? '',
|
|
68
|
-
createWhenMissing: openPr ? null : { title }
|
|
69
|
-
});
|
|
70
|
-
logger.newline();
|
|
71
|
-
logger.success('PR is ready for approval');
|
|
72
|
-
logger.hint(`The assignee approves it by running: idea1 approve-pr --target ${branchName} (which merges it)`);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* The PR title, defaulting to `Integration <name> <date>` for an integration branch and to the
|
|
76
|
-
* branch name otherwise.
|
|
77
|
-
*/
|
|
78
|
-
async function promptPrTitle(branchName) {
|
|
79
|
-
const integrationBranches = await worktree.listExistingIntegrationBranches();
|
|
80
|
-
const defaultTitle = integrationBranches.includes(branchName)
|
|
81
|
-
? `Integration ${await worktree.extractIntegrationName(branchName)} ${new Date().toISOString().split('T')[0]}`
|
|
82
|
-
: branchName;
|
|
83
|
-
return promptInput('Enter PR title:', { default: defaultTitle });
|
|
84
|
-
}
|
|
85
7
|
export const readyForApprovalCommand = {
|
|
86
8
|
name: 'ready-for-approval',
|
|
87
9
|
aliases: ['rfa'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ready-for-approval.js","sourceRoot":"","sources":["../../src/commands/ready-for-approval.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ready-for-approval.js","sourceRoot":"","sources":["../../src/commands/ready-for-approval.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,kCAAkC,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACnH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,M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,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAgOjD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,EAAE,OAoH5B,CAAC"}
|
package/dist/commands/release.js
CHANGED
|
@@ -9,7 +9,7 @@ import { TARGET_OPTION_NAME, parseTargets, prepareTargetRuns, promptForTargets }
|
|
|
9
9
|
import { WorkflowStates } from '../workflow/data/workflow-states.js';
|
|
10
10
|
import { mergeConfirmationOption } from '../workflow/engine/approval-flow.js';
|
|
11
11
|
import { approvePrCommand } from './approve-pr.js';
|
|
12
|
-
import { PR_MODE_OPTION, RELEASE_KIND, VERSION_BUMP_TYPES, approveRelease, commitVersionBumps, createGatedPr, detectPendingVersionBumps, runPrMode, validateSourceBranch } from '../workflow/engine/release-engine.js';
|
|
12
|
+
import { PR_MODE_OPTION, RELEASE_KIND, VERSION_BUMP_TYPES, approveRelease, commitVersionBumps, createGatedPr, detectPendingVersionBumps, ensureReleasable, runPrMode, validateSourceBranch } from '../workflow/engine/release-engine.js';
|
|
13
13
|
/**
|
|
14
14
|
* Resolve the release branch (source branch)
|
|
15
15
|
*/
|
|
@@ -62,8 +62,8 @@ function parseBumpsOption(value) {
|
|
|
62
62
|
* The versioned packages that need a bump for the release, with the bump type of each: from
|
|
63
63
|
* `--bumps`, else asked. Counts the changes of `incomingBranches`, the branches approved into the
|
|
64
64
|
* release branch before it is released, as the release's own. None when the repository declares no
|
|
65
|
-
* versioned packages
|
|
66
|
-
* release PR, which may already be approved.
|
|
65
|
+
* versioned packages. The caller has already refused a release with a PR open, so a bump is never
|
|
66
|
+
* made onto an open release PR, which may already be approved.
|
|
67
67
|
*/
|
|
68
68
|
async function resolvePendingBumps(sourceBranch, targetBranch, requestedBumps, incomingBranches) {
|
|
69
69
|
const settings = await readReleaseSettings(await git.getRepoRoot());
|
|
@@ -79,11 +79,6 @@ async function resolvePendingBumps(sourceBranch, targetBranch, requestedBumps, i
|
|
|
79
79
|
throw new Error(`--bumps names unknown package(s): ${unknownNames.join(', ')}. ` +
|
|
80
80
|
`The versioned packages are: ${knownNames.join(', ')}.`);
|
|
81
81
|
}
|
|
82
|
-
if (await github.checkPrExists(sourceBranch, targetBranch)) {
|
|
83
|
-
logger.dim('A release PR is already open, so no version bump is made onto it');
|
|
84
|
-
logger.newline();
|
|
85
|
-
return { pending: [], bumps: {} };
|
|
86
|
-
}
|
|
87
82
|
logger.step('Checking which versioned packages changed since the last release...');
|
|
88
83
|
const pending = await detectPendingVersionBumps(settings.versionedPackages, sourceBranch, targetBranch, incomingBranches);
|
|
89
84
|
if (pending.length === 0) {
|
|
@@ -134,6 +129,7 @@ async function releaseWithApprovals(sourceBranch, targetBranch, targets, resolve
|
|
|
134
129
|
logger.newline();
|
|
135
130
|
// The release runs in this checkout once the approvals have merged, so it must be fit for that now.
|
|
136
131
|
await validateSourceBranch(sourceBranch);
|
|
132
|
+
await ensureReleasable(sourceBranch, targetBranch);
|
|
137
133
|
const { runs, summaries } = await prepareTargetRuns(approvePrCommand, targets, resolved, {
|
|
138
134
|
advancesTo: () => WorkflowStates.ApprovedAndMerged,
|
|
139
135
|
itemlessBranches: true,
|
|
@@ -253,6 +249,7 @@ export const releaseCommand = {
|
|
|
253
249
|
logger.header(`Release: ${sourceBranch} -> ${targetBranch}`);
|
|
254
250
|
logger.newline();
|
|
255
251
|
await validateSourceBranch(sourceBranch);
|
|
252
|
+
await ensureReleasable(sourceBranch, targetBranch);
|
|
256
253
|
await bumpPendingVersions(sourceBranch, targetBranch, parseBumpsOption(resolved['bumps']));
|
|
257
254
|
const prTitle = titleArg ?? await promptPrTitle();
|
|
258
255
|
logger.info(`Using title: ${prTitle}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,SAAS,EACT,oBAAoB,EAIrB,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,KAAK,UAAU,oBAAoB,CAAC,SAAkB;IACpD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,CAAC,MAAM,kBAAkB,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AACxE,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,mBAAmB,CAAC,SAAkB;IACnD,IAAI,SAAS,EAAE,C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,CAAC,IAAI,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC"}
|
|
@@ -3,6 +3,8 @@ import type { Command } from '../types/index.js';
|
|
|
3
3
|
* `start --carry-local-changes --approve-and-merge` with nothing asked beyond what a new item
|
|
4
4
|
* needs (its title and Project): the uncommitted changes of the base branch checkout become a
|
|
5
5
|
* project item's branch and PR, which merges into the base branch once the required checks pass.
|
|
6
|
+
* With the title left blank no item is created: the changes become a branch with no project item,
|
|
7
|
+
* which goes through the same approval and merge.
|
|
6
8
|
*/
|
|
7
9
|
export declare const shipLocalChangesCommand: Command;
|
|
8
10
|
//# sourceMappingURL=ship-local-changes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship-local-changes.d.ts","sourceRoot":"","sources":["../../src/commands/ship-local-changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ship-local-changes.d.ts","sourceRoot":"","sources":["../../src/commands/ship-local-changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAajD;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,OA8CrC,CAAC"}
|
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
import { isolationModeOption } from '../lib/isolation.js';
|
|
2
2
|
import { branchCreationOptions } from '../workflow/engine/branch-setup.js';
|
|
3
|
-
import { approveAndMergeOption, carryLocalChangesOption, commitMessageOption, unpromptedReviewersOption } from '../workflow/engine/ship-flow.js';
|
|
3
|
+
import { approveAndMergeOption, carryLocalChangesOption, commitMessageOption, shipWithoutItem, unpromptedReviewersOption } from '../workflow/engine/ship-flow.js';
|
|
4
4
|
import { TARGET_OPTION_NAME } from '../jobs/targets.js';
|
|
5
5
|
import { projectItemTargetOptions, startProjectItem } from './start.js';
|
|
6
6
|
/**
|
|
7
7
|
* `start --carry-local-changes --approve-and-merge` with nothing asked beyond what a new item
|
|
8
8
|
* needs (its title and Project): the uncommitted changes of the base branch checkout become a
|
|
9
9
|
* project item's branch and PR, which merges into the base branch once the required checks pass.
|
|
10
|
+
* With the title left blank no item is created: the changes become a branch with no project item,
|
|
11
|
+
* which goes through the same approval and merge.
|
|
10
12
|
*/
|
|
11
13
|
export const shipLocalChangesCommand = {
|
|
12
14
|
name: 'ship-local-changes',
|
|
13
15
|
aliases: ['ship'],
|
|
14
|
-
description: 'Ship the uncommitted changes of your base branch checkout: create a project item and its branch, commit and push the changes there, and advance it through approval, merging its PR once the checks pass',
|
|
16
|
+
description: 'Ship the uncommitted changes of your base branch checkout: create a project item (optional) and its branch, commit and push the changes there, and advance it through approval, merging its PR once the checks pass',
|
|
15
17
|
options: [
|
|
16
|
-
...projectItemTargetOptions.map(option =>
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
...projectItemTargetOptions.map(option => {
|
|
19
|
+
switch (option.longName) {
|
|
20
|
+
case TARGET_OPTION_NAME:
|
|
21
|
+
return { ...option, description: 'Project item URL, or its branch name or PR URL (default: create a new item)', promptWhenDefaultExists: false };
|
|
22
|
+
case 'title':
|
|
23
|
+
return {
|
|
24
|
+
...option,
|
|
25
|
+
description: 'Title for the new project item (leave blank to ship without a project item)',
|
|
26
|
+
defaultValue: '',
|
|
27
|
+
promptWhenDefaultExists: true,
|
|
28
|
+
validate: undefined
|
|
29
|
+
};
|
|
30
|
+
case 'project':
|
|
31
|
+
return { ...option, dependsOn: (resolved) => !resolved[TARGET_OPTION_NAME] && !!resolved['title'].trim() };
|
|
32
|
+
default:
|
|
33
|
+
return option;
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
19
36
|
...branchCreationOptions
|
|
20
37
|
.filter(option => option.longName !== 'workflow-type')
|
|
21
38
|
.map(option => ({ ...option, dependsOn: undefined, defaultValue: '', promptWhenDefaultExists: false })),
|
|
@@ -24,6 +41,14 @@ export const shipLocalChangesCommand = {
|
|
|
24
41
|
unpromptedReviewersOption
|
|
25
42
|
],
|
|
26
43
|
async execute(resolved) {
|
|
44
|
+
if (!resolved[TARGET_OPTION_NAME].trim() && !resolved['title'].trim()) {
|
|
45
|
+
const sourcePath = resolved['source-path'];
|
|
46
|
+
if (sourcePath) {
|
|
47
|
+
process.chdir(sourcePath);
|
|
48
|
+
}
|
|
49
|
+
await shipWithoutItem(resolved);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
27
52
|
await startProjectItem({
|
|
28
53
|
...resolved,
|
|
29
54
|
[carryLocalChangesOption.longName]: 'true',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship-local-changes.js","sourceRoot":"","sources":["../../src/commands/ship-local-changes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"ship-local-changes.js","sourceRoot":"","sources":["../../src/commands/ship-local-changes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE;;;;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,OAAO,CAAC,QAAgC;QAC5C,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACtE,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC3C,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;YACD,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;YAChC,OAAO;QACT,CAAC;QACD,MAAM,gBAAgB,CAAC;YACrB,GAAG,QAAQ;YACX,CAAC,uBAAuB,CAAC,QAAQ,CAAC,EAAE,MAAM;YAC1C,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM;SACzC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -143,6 +143,16 @@ export interface CreatePrOptions {
|
|
|
143
143
|
* Create a PR with its body and assignee set at creation, returning its URL.
|
|
144
144
|
*/
|
|
145
145
|
export declare function createPr(options: CreatePrOptions): Promise<string>;
|
|
146
|
+
/** An open PR as the release workflow checks it: its description and its approvers of record. */
|
|
147
|
+
export interface OpenPr {
|
|
148
|
+
number: number;
|
|
149
|
+
url: string;
|
|
150
|
+
/** The description, empty when none was written. */
|
|
151
|
+
body: string;
|
|
152
|
+
assignees: string[];
|
|
153
|
+
}
|
|
154
|
+
/** The open PR from `headBranch` into `baseBranch`, or null when there is none. */
|
|
155
|
+
export declare function getOpenPr(headBranch: string, baseBranch: string): Promise<OpenPr | null>;
|
|
146
156
|
/**
|
|
147
157
|
* Read who a PR's assignee is. The assignee is its approver, so `idea1 approve-pr` reports it
|
|
148
158
|
* before merging.
|
|
@@ -176,11 +186,19 @@ export interface CommitPullRequest {
|
|
|
176
186
|
* "Merge pull request" subject to parse, but GitHub still knows which PR the commit came from.
|
|
177
187
|
*/
|
|
178
188
|
export declare function getPullRequestsForCommit(sha: string): Promise<CommitPullRequest[]>;
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
189
|
+
/** The repository and what the authenticated user may do in it. */
|
|
190
|
+
export interface RepoAccess {
|
|
191
|
+
/** The repository as `owner/name`. */
|
|
192
|
+
fullName: string;
|
|
193
|
+
/** Whether the user may push to it, which also lets them open and merge PRs. */
|
|
194
|
+
push: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Whether the user is an admin on it. The overrides in change-management-policy.md are the
|
|
197
|
+
* CTO's to make, and repository admin is how that authority is expressed in GitHub - so an
|
|
198
|
+
* override that has no GitHub gate of its own is checked here rather than taken on the caller's word.
|
|
199
|
+
*/
|
|
200
|
+
admin: boolean;
|
|
201
|
+
}
|
|
202
|
+
/** The authenticated user's access to the repository of the current checkout. */
|
|
203
|
+
export declare function getRepoAccess(): Promise<RepoAccess>;
|
|
186
204
|
//# sourceMappingURL=github.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/services/github.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAShD;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAIrD;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAyBtG;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAchF;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,KAAK,UAAQ,GACZ,OAAO,C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
543
543
|
}
|
|
544
544
|
return result.stdout.trim();
|
|
545
545
|
}
|
|
546
|
+
/** The open PR from `headBranch` into `baseBranch`, or null when there is none. */
|
|
547
|
+
export async function getOpenPr(headBranch, baseBranch) {
|
|
548
|
+
await ensureGitHubCli();
|
|
549
|
+
const result = await exec('gh', [
|
|
550
|
+
'pr', 'list',
|
|
551
|
+
'--head', headBranch,
|
|
552
|
+
'--base', baseBranch,
|
|
553
|
+
'--json', 'number,url,body,assignees',
|
|
554
|
+
'--jq', '[.[] | { number: .number, url: .url, body: .body, assignees: [.assignees[].login] }] | .[0]'
|
|
555
|
+
]);
|
|
556
|
+
if (result.exitCode !== 0) {
|
|
557
|
+
throw new Error(`Could not read the open PR from ${headBranch} into ${baseBranch}: ${result.stderr}`);
|
|
558
|
+
}
|
|
559
|
+
const output = result.stdout.trim();
|
|
560
|
+
return output && output !== 'null' ? JSON.parse(output) : null;
|
|
561
|
+
}
|
|
546
562
|
/**
|
|
547
563
|
* Read who a PR's assignee is. The assignee is its approver, so `idea1 approve-pr` reports it
|
|
548
564
|
* before merging.
|
|
@@ -605,18 +621,16 @@ export async function getPullRequestsForCommit(sha) {
|
|
|
605
621
|
}
|
|
606
622
|
return JSON.parse(result.stdout);
|
|
607
623
|
}
|
|
608
|
-
/**
|
|
609
|
-
|
|
610
|
-
* change-management-policy.md are the CTO's to make, and repository admin is how that authority is
|
|
611
|
-
* expressed in GitHub - so an override that has no GitHub gate of its own is checked here rather
|
|
612
|
-
* than taken on the caller's word.
|
|
613
|
-
*/
|
|
614
|
-
export async function isCurrentUserRepoAdmin() {
|
|
624
|
+
/** The authenticated user's access to the repository of the current checkout. */
|
|
625
|
+
export async function getRepoAccess() {
|
|
615
626
|
await ensureGitHubCli();
|
|
616
|
-
const result = await exec('gh', [
|
|
627
|
+
const result = await exec('gh', [
|
|
628
|
+
'api', 'repos/{owner}/{repo}',
|
|
629
|
+
'--jq', '{ fullName: .full_name, push: (.permissions.push == true), admin: (.permissions.admin == true) }'
|
|
630
|
+
]);
|
|
617
631
|
if (result.exitCode !== 0) {
|
|
618
632
|
throw new Error(`Could not read your permissions on the repository: ${result.stderr}`);
|
|
619
633
|
}
|
|
620
|
-
return result.stdout
|
|
634
|
+
return JSON.parse(result.stdout);
|
|
621
635
|
}
|
|
622
636
|
//# sourceMappingURL=github.js.map
|