Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GitHub Organization as Code

GitHub organization managed as code.
GitHub organization managed as code. Implements a GitOps workflow to transform a YAML - declarative GitHub organization definition into GitHub resources, automating configuration of repositories.

## Features

Expand Down Expand Up @@ -107,10 +107,19 @@ Create the configuration file:
---
repositories:
- name: repo-slug
# Metadata
description: "The repository description." # OPTIONAL, DEFAULT none
homepage_url: https://example.com/ # OPTIONAL, DEFAULT none
topics: # OPTIONAL, DEFAULT none
- some-topic
- another-topic
# Properties
is_template: true # OPTIONAL, DEFAULT false
# Contents
template: # OPTIONAL, DEFAULT none
owner: bruzit
repository: template
include_all_branches: true # OPTIONAL, DEFAULT false
```

Set it as source of truth:
Expand Down
17 changes: 17 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,21 @@ resource "github_repository" "this" {
description = try(each.value.description, null)
homepage_url = try(each.value.homepage_url, null)
topics = try(each.value.topics, null)

# Properties
is_template = try(each.value.is_template, null)

# Contents
dynamic "template" {
for_each = (
try(each.value.template, null) != null &&
length(try(each.value.template, {})) > 0
) ? [each.value.template] : []

content {
owner = template.value.owner
repository = template.value.repository
include_all_branches = try(template.value.include_all_branches, false)
}
}
}
14 changes: 12 additions & 2 deletions test.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
---
repositories:
- name: .github
description: "BruzIT Test organization profile and management."
description: "BruzIT Test organization profile and repository management."
topics:
- github-organization-profile
- github-profile
- github-profile-readme
- github-organization-profile
- github-organization-management
- name: template
description: "Standardized repository scaffold for BruzIT projects. Pre-configured with semantic-release, license boilerplate, README structure, and initial v0.0.0 tag."
topics:
- repository-template
is_template: true
- name: template-use
template:
owner: bruzit-test
repository: template