Add gh-auth

Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2023-02-09 17:37:44 +01:00
parent e1754adefa
commit 29534d2453
3 changed files with 35 additions and 1 deletions
@@ -0,0 +1,30 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import chalk from 'chalk';
import inquirer from 'inquirer';
import createGithubApp from '../create-github-app';
export default async () => {
// TODO: Make the GitHub Org optional
const input = await inquirer.prompt<{ org: string }>([
{
type: 'input',
name: 'org',
message: chalk.blue('Enter a GitHub Org [required]'),
},
]);
await createGithubApp(input.org);
};
@@ -117,8 +117,11 @@ export class GithubCreateAppServer {
...(this.permissions.includes('members') && { members: 'read' }),
...(this.permissions.includes('read') && { contents: 'read' }),
...(this.permissions.includes('write') && {
administration: 'write',
contents: 'write',
actions: 'write',
pull_requests: 'write',
issues: 'write',
workflows: 'write',
}),
},
name: 'Backstage-<changeme>',
@@ -26,6 +26,7 @@ import openBrowser from 'react-dev-utils/openBrowser';
// 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
export default async (org: string) => {
// Why is the Org check not done here?
const answers: Answers = await inquirer.prompt({
name: 'appType',
type: 'checkbox',