Reputation: 27231
Is there a way to store my github repo's settings "as-code" rather than interacting with the settings via UI? Aka these things:
I would like to do this so that:
Right now our team has several admins and people frequently update settings. This makes it hard to understand why settings are setup a certain way. This is paticularly an issue with branch protection rules:
I would like some way to store all of these settings in a text file, either in YAML or Terraform or something else. Is this possible?
Upvotes: 0
Views: 80
Reputation: 668
There are mainly 3 options that I've found. I haven't tried either of them myself yet though.
https://github.com/github/safe-settings
an app to manage policy-as-code and apply repository settings across an organization.
Custom script with GH CLI similar to https://github.com/adamchainz/scripts/blob/main/myrepos/0000-repo-settings.sh
Terraform https://registry.terraform.io/providers/integrations/github/latest/docs
P.S. .github/ (even euphemeral) approach doesn't seem adequate as it would allow anybody having commit access to update repo settings, which effectively hijacks GH permissions model.
Upvotes: 1