An operator to manage policy-as-code and apply repository settings to repositories across an organization.
- Create GitHub Token with access to
repo,write:org, andread:org - Deploy on Kubernetes cluster:
git clone github.com/Hunter-Thompson/github-operator
cd github-operator
kubectl create secret generic github-operator-secret --from-literal GITHUB_TOKEN=ghp_sjdnfksdfnjksdf
kubectl apply -f docs/install.yaml# https://docs.github.com/en/rest/teams/teams?apiVersion=2022年11月28日#create-a-team # https://docs.github.com/en/rest/teams/teams?apiVersion=2022年11月28日#update-a-team apiVersion: settings.github.com/v1beta1 kind: Team metadata: name: team-sample spec: organization: ocktokit description: 'asd' maintainers: - Hunter-Thompson repoNames: - repo1 - anotherrepo privacy: secret parentTeamId: 1829
# https://docs.github.com/en/rest/repos/repos?apiVersion=2022年11月28日#create-an-organization-repository # https://docs.github.com/en/rest/repos/repos?apiVersion=2022年11月28日#update-a-repository apiVersion: settings.github.com/v1beta1 kind: Repository metadata: name: repo-sample spec: organization: ocktokit description: "asd" homepage: "https://home.page" topics: - topic1 - topic2 private: false hasIssues: false hasPages: false hasWiki: false defaultBranch: master allowSquashMerge: true allowMergeCommit: true allowRebaseMerge: true allowAutoMerge: true deleteBranchOnMerge: true isTemplate: false squashMergeCommitTitle: "PR_TITLE" squashMergeCommitMessage: "COMMIT_MESSAGES" mergeCommitTitle: "PR_TITLE" mergeCommitMessage: "PR_BODY" repositoryCollaborators: adminPermission: - Hunter-Thompson1 pushPermission: - Hunter-Thompson2 pullPermission: - Hunter-Thompson3
Copyright 2023.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.