Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | /**
* GitHub App manifest builder for the setup-app flow.
*/
export interface ManifestOptions {
name?: string;
port: number;
}
export interface GitHubAppManifest {
name: string;
url: string;
hook_attributes: {
url: string;
active: boolean;
};
redirect_url: string;
public: boolean;
default_permissions: Record<string, string>;
default_events: string[];
}
/**
* Build a GitHub App manifest for Warden.
*/
export function buildManifest(options: ManifestOptions): GitHubAppManifest {
const name = options.name ?? 'Warden';
return {
name,
url: 'https://github.com/getsentry/warden',
hook_attributes: {
// URL is required by GitHub even when webhooks are disabled
url: 'https://example.com/webhook',
active: false,
},
redirect_url: `http://localhost:${options.port}/callback`,
public: false,
// contents: write required for resolving review threads via GraphQL
// See: https://github.com/orgs/community/discussions/44650
default_permissions: {
contents: 'write',
pull_requests: 'write',
issues: 'write',
checks: 'write',
metadata: 'read',
},
default_events: ['pull_request'],
};
}
|