Skip to content

Commit

Permalink
add addTeam
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Jul 12, 2024
1 parent 11b68ea commit 0e18e8a
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ class GH(private val path: Path) {
)
}

fun addTeam(team: String, permission: String) {
val repository = repository()
// Succeeds even if the team is already there
path.runCommand(
"gh",
"api",
"--method", "PUT",
"-H", "Accept: application/vnd.github+json",
"-H", "X-GitHub-Api-Version: 2022-11-28",
"/orgs/${repository.owner}/teams/$team/repos/${repository.owner}/${repository.name}",
"-f", "permission=$permission"
)
}

fun createBranch(branch: String) {
val repository = repository()
var result = path.runCommandAndCaptureStdout(
Expand Down

0 comments on commit 0e18e8a

Please sign in to comment.