From 1b5c264aa40512446aa808211076c206c80256a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 26 Aug 2024 14:49:18 +0200 Subject: [PATCH] add check reads among the default github app permissions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/green-worms-rescue.md | 5 +++++ .../create-github-app/GithubCreateAppServer.ts | 10 ++++++++-- packages/cli/src/commands/create-github-app/index.ts | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/green-worms-rescue.md diff --git a/.changeset/green-worms-rescue.md b/.changeset/green-worms-rescue.md new file mode 100644 index 0000000000..992012ad7d --- /dev/null +++ b/.changeset/green-worms-rescue.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Add `checks: 'read'` for default GitHub app permissions diff --git a/packages/cli/src/commands/create-github-app/GithubCreateAppServer.ts b/packages/cli/src/commands/create-github-app/GithubCreateAppServer.ts index 70b8c0ca53..b1825ad996 100644 --- a/packages/cli/src/commands/create-github-app/GithubCreateAppServer.ts +++ b/packages/cli/src/commands/create-github-app/GithubCreateAppServer.ts @@ -114,10 +114,16 @@ export class GithubCreateAppServer { default_events: ['create', 'delete', 'push', 'repository'], default_permissions: { metadata: 'read', - ...(this.permissions.includes('members') && { members: 'read' }), - ...(this.permissions.includes('read') && { contents: 'read' }), + ...(this.permissions.includes('members') && { + members: 'read', + }), + ...(this.permissions.includes('read') && { + contents: 'read', + checks: 'read', + }), ...(this.permissions.includes('write') && { contents: 'write', + checks: 'read', actions: 'write', }), }, diff --git a/packages/cli/src/commands/create-github-app/index.ts b/packages/cli/src/commands/create-github-app/index.ts index 6b3e732f18..681b471c91 100644 --- a/packages/cli/src/commands/create-github-app/index.ts +++ b/packages/cli/src/commands/create-github-app/index.ts @@ -22,6 +22,7 @@ import { paths } from '../../lib/paths'; import { GithubCreateAppServer } from './GithubCreateAppServer'; import fetch from 'node-fetch'; import openBrowser from 'react-dev-utils/openBrowser'; + // This is an experimental command that at this point does not support GitHub Enterprise // due to lacking support for creating apps from manifests. // https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-a-github-app-from-a-manifest