Skip to content

Commit

Permalink
adding team creation
Browse files Browse the repository at this point in the history
  • Loading branch information
enyil committed Nov 19, 2021
1 parent fff5c4d commit 3d44d83
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 29 deletions.
52 changes: 26 additions & 26 deletions app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,36 @@ default_events:
# - check_run
# - check_suite
# - commit_comment
# - create
- create
# - delete
# - deployment
# - deployment_status
# - fork
# - gollum
# - issue_comment
- issues
# - label
# - milestone
# - member
# - membership
# - org_block
# - organization
# - page_build
# - project
# - project_card
# - project_column
# - public
# - pull_request
# - pull_request_review
# - pull_request_review_comment
# - push
# - release
# - repository
# - repository_import
# - status
# - team
# - team_add
# - watch
# - label
# - milestone
# - member
# - membership
# - org_block
# - organization
# - page_build
# - project
# - project_card
# - project_column
# - public
# - pull_request
# - pull_request_review
# - pull_request_review_comment
# - push
# - release
- repository
# - repository_import
# - status
# - team
# - team_add
# - watch

# The set of permissions needed by the GitHub App. The format of the object uses
# the permission name for the key (for example, issues) and the access type for
Expand All @@ -54,15 +54,15 @@ default_events:
default_permissions:
# Repository creation, deletion, settings, teams, and collaborators.
# https://developer.github.com/v3/apps/permissions/#permission-on-administration
# administration: read
administration: read

# Checks on code.
# https://developer.github.com/v3/apps/permissions/#permission-on-checks
# checks: read

# Repository contents, commits, branches, downloads, releases, and merges.
# https://developer.github.com/v3/apps/permissions/#permission-on-contents
# contents: read
contents: read

# Deployments and deployment statuses.
# https://developer.github.com/v3/apps/permissions/#permission-on-deployments
Expand Down Expand Up @@ -134,4 +134,4 @@ default_permissions:

# Set to true when your GitHub App is available to the public or false when it is only accessible to the owner of the app.
# Default: true
# public: false
public: false
33 changes: 30 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,39 @@ module.exports = (app) => {
app.log.info("Yay, the app was loaded!");

app.on("repository.created", async (context) => {
const issueComment = context.issue({
body: "Thanks for opening this issue!",

const team_name = "team_name"

context.octokit.teams.addOrUpdateRepoPermissionsInOrg({
org: "github",
team_slug: team_name + "_admin",
repo: repo.name,
permission: "admin"
});

context.octokit.teams.addOrUpdateRepoPermissionsInOrg({
org: "github",
team_slug: team_name + "_read",
repo: repo.name,
permission: "pull"
});

context.octokit.teams.addOrUpdateRepoPermissionsInOrg({
org: "github",
team_slug: team_name + "_write",
repo: repo.name,
permission: "push"
});
return context.octokit.issues.createComment(issueComment);
});

// Sample action
// app.on("issues.opened", async (context) => {
// const issueComment = context.issue({
// body: "Thanks for opening this issue!",
// });
// return context.octokit.issues.createComment(issueComment);
// });

// For more information on building apps:
// https://probot.github.io/docs/

Expand Down

0 comments on commit 3d44d83

Please sign in to comment.