Skip to content

Commit 2c66bf3

Browse files
committed
Update team perms setting
1 parent 67d5c36 commit 2c66bf3

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

dist/index.js

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/github/repos.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,23 @@ export async function create(
3232
const token: string = core.getInput('github_token', { required: true })
3333
const octokit = github.getOctokit(token)
3434

35-
// TODO: Check if the repo already exists.
3635
const response = await octokit.rest.repos.createUsingTemplate({
3736
template_owner: Common.OWNER,
3837
template_repo: Common.TEMPLATE_REPO,
3938
owner: Common.OWNER,
4039
name: generateRepoName(request, user),
4140
description: `GitHub Intermediate - ${request.customerName}`,
4241
include_all_branches: true,
43-
visibility: 'private',
44-
team_id: team.id
42+
private: true
43+
})
44+
45+
// Grant the team access to the repository.
46+
await octokit.rest.teams.addOrUpdateRepoPermissionsInOrg({
47+
org: Common.OWNER,
48+
team_slug: team.slug,
49+
owner: Common.OWNER,
50+
repo: response.data.name,
51+
permission: 'admin'
4552
})
4653

4754
return response.data.name
@@ -88,7 +95,7 @@ export async function configure(
8895
await octokit.rest.repos.update({
8996
owner: Common.OWNER,
9097
repo,
91-
homepage: response.data.url
98+
homepage: response.data.html_url
9299
})
93100

94101
// Configure the exec options.

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export async function run(): Promise<void> {
6060
if (action === AllowedIssueAction.CREATE) {
6161
core.info('Processing Class Create')
6262

63+
// TODO: Check if team, repos, and/or users already exist and fail if they do.
64+
6365
// Create the team and add the users.
6466
const team = await teams.create(request)
6567

0 commit comments

Comments
 (0)