Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ Debian package is not used are recorded in

```sh
gcb gh pr view 12 --repo owner/name
gcb gh pr create --repo owner/name --head feat/x --title "A title" --body "A body"
gcb gh pr create -R owner/name --head feat/x --title "A title" --body "A body"
gcb gh run view 123456 --log --repo owner/name
```

`-R` is the short form of `--repo`, as in `gh` itself.

Inside a checkout, `--repo` can be omitted only when `origin` names a usable GitHub repository whose
host matches `--host`; otherwise pass `--repo`, or the matching `--host`.

Expand Down
11 changes: 6 additions & 5 deletions packages/client/src/commands/gh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export const GH_USAGE = `Usage: gcb gh <domain> <command> [options]
Run a catalogued GitHub action through the broker.

Common
--repo <owner/name> Repository the action belongs to (default: origin remote)
--host <host> Host as configured, e.g. github.com (default: github.com)
--socket <path> Broker socket (default: GIT_BROKER_SOCKET)
-h, --help Show this help
-R, --repo <owner/name> Repository the action belongs to (default: origin remote)
--host <host> Host as configured, e.g. github.com (default: github.com)
--socket <path> Broker socket (default: GIT_BROKER_SOCKET)
-h, --help Show this help

Commands, from the action catalog
${ACTION_LINES}`;
Expand Down Expand Up @@ -84,7 +84,7 @@ export async function runGh(argv: readonly string[]): Promise<number> {
const booleans = action.flags.filter((flag) => flag.type === 'boolean').map((flag) => flag.name);
const args = parseArgs(rest, { booleans });
const host = args.value('host') ?? 'github.com';
let repo = args.value('repo');
let repo = args.value('repo') ?? args.value('R');
if (repo === undefined) {
const found = repoFromCheckout(process.cwd());
if (found === undefined) fail('--repo is required when the checkout has no usable origin remote');
Expand All @@ -99,6 +99,7 @@ export async function runGh(argv: readonly string[]): Promise<number> {
const allowed = new Set([
...action.flags.map((flag) => flag.name),
'repo',
'R',
'host',
'socket',
]);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/gh-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('gcb gh', () => {
};
const broker = await startBroker({ config, audit, providers: new Map([['github.com', provider]]) });
try {
const result = await runGhCli(['pr', 'view', '7', '--repo', 'acme/widget', '--socket', socketPath]);
const result = await runGhCli(['pr', 'view', '7', '-R', 'acme/widget', '--socket', socketPath]);
assert.equal(result.status, 1);
assert.match(result.stderr, /expires on its own/);
assert.match(result.stderr, /refused/);
Expand Down
Loading