Skip to content

Commit

Permalink
Merge pull request #9 from cloudnativerioja/feature/import_this_repo
Browse files Browse the repository at this point in the history
Feature/import this repo
  • Loading branch information
statickidz authored Sep 2, 2023
2 parents 03ff617 + e4165ad commit 099ad8b
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 5 deletions.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# github-org-iac
Repository to manage users and teams in the github organisation with pulumi

Repository to manage users and teams in the github organization with Pulumi and Golang. Everything are defined in the `config/org.yaml` file and automated with GitHub Actions. Follow the steps below to add a new user, team or repository.

## Adding a new user

1. Add the user to the map `members` list in `config/org.yaml`
2. Push the changes to GitHub
3. Create a Pull Request
4. Wait for the approval and merge

## Adding a new team

1. Add the team to the map `teams` list in `config/org.yaml`
2. Push the changes to GitHub
3. Create a Pull Request
4. Wait for the approval and merge

## Adding a new repository

1. Add the repository to the map `repositories` list in `config/org.yaml`
2. Push the changes to GitHub
3. Create a Pull Request
4. Wait for the approval and merge

## References

- [Pulumi GitHub Provider](https://www.pulumi.com/docs/intro/cloud-providers/github/setup/)
- [Pulumi GitHub Provider API Reference](https://www.pulumi.com/docs/reference/pkg/github/)
14 changes: 14 additions & 0 deletions config/org.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
######################
# Organization
######################

organization: cloudnativerioja
teams:
- name: Collaborators
Expand Down Expand Up @@ -35,3 +39,13 @@ teams:
role: member
- username: mario-ezquerro
role: member

######################
# Repositories
######################

repositories:
- name: github-org-iac
description: Repository to manage users and teams in the github organisation with pulumi
visibility: public
topics: [iac, pulumi, github, golang, organization, cloudnativerioja]
24 changes: 20 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ type Team struct {
}

type Repository struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Name string `yaml:"name"`
Description string `yaml:"description"`
Visibility string `yaml:"visibility"`
Topics []string `yaml:"topics"`
}

type GitHubEntities struct {
Expand All @@ -46,8 +48,22 @@ func main() {
// Create Github repositories
for _, repo := range data.Repositories {
_, err := github.NewRepository(ctx, repo.Name, &github.RepositoryArgs{
Description: pulumi.String(repo.Description),
Name: pulumi.String(repo.Name),
Description: pulumi.String(repo.Description),
Name: pulumi.String(repo.Name),
HasDownloads: pulumi.Bool(true),
HasIssues: pulumi.Bool(true),
HasProjects: pulumi.Bool(true),
HasWiki: pulumi.Bool(true),
SecurityAndAnalysis: &github.RepositorySecurityAndAnalysisArgs{
SecretScanning: &github.RepositorySecurityAndAnalysisSecretScanningArgs{
Status: pulumi.String("disabled"),
},
SecretScanningPushProtection: &github.RepositorySecurityAndAnalysisSecretScanningPushProtectionArgs{
Status: pulumi.String("disabled"),
},
},
Visibility: pulumi.String(repo.Visibility),
Topics: pulumi.ToStringArray(repo.Topics),
})
if err != nil {
return err
Expand Down

0 comments on commit 099ad8b

Please sign in to comment.