hello world
  • JavaScript 98.7%
  • TypeScript 1.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2022-10-28 22:48:21 +02:00
.github chore: init 2022-10-28 22:48:21 +02:00
.husky chore: init 2022-10-28 22:48:21 +02:00
bundle chore: init 2022-10-28 22:48:21 +02:00
src chore: init 2022-10-28 22:48:21 +02:00
.eslintrc chore: init 2022-10-28 22:48:21 +02:00
.gitignore chore: init 2022-10-28 22:48:21 +02:00
action.yml chore: init 2022-10-28 22:48:21 +02:00
commitlint.config.js chore: init 2022-10-28 22:48:21 +02:00
package.json chore: init 2022-10-28 22:48:21 +02:00
README.md chore: init 2022-10-28 22:48:21 +02:00
tsconfig.json chore: init 2022-10-28 22:48:21 +02:00
yarn.lock chore: init 2022-10-28 22:48:21 +02:00

GitHub Config

Are you always forgetting to set up you GitHub repos, or are you just tired of all the time it takes to do so through the interface? than this project is for you!

This is a GitHub Action/CLI tool/node library for updating a GitHub repos configuration though a configuration file instead of an interface, so that you can easily share you configuration between repos and ensure that all of them are configured just the way you like it!

WARNING: This project is early stage and should serve more as a teaser than a production ready solution

Configure with GitHub Action

The main intention of this project is to allow you to configure the repository, using a file inside the repository. This way you can actually use your GitHub flow for updating the configuration, by for instance requiring changes to come through pull requests and require a code owner of the configuration to review and approve the changes. Git will then also be you change log, capturing who changed what, when and if they are nice enough to make good commit messages, why.

To easily enroll projects you will be able to use github-config enroll <username> <repo>, once the CLI is up and running, but for now, there is a manual guide below.

First thing is that we need to add a GitHub PAT to the repo. Unfortunatly we can not use the GITHUB_TOKEN from the action here as there are no way to grant it the access it needs (luckily). Start by Generating a new fine-grained access token and give it read and write access to administration, environments, and pages.

Now create a new environment in the repo called config and add a secret called GH_TOKEN with your new PAT. Also add any additional protection here that you want, as this is intended as a way to run admin tasks, and you don't all of a sudden want users with only write access to do admin tasks from your actions right?

Next add a configuration to the project inside .github/repo.yml. For now we are just using a pretty simple config, but you can see the full configuration schema inside here (more readable version on the way)

general:
  description: hello world
  wikis: false
  issues: true
  projects: false

And next we need to add the workflow into our workflows folder

on: 
  push:
    branches:
      - main
    paths:
      - .github/repo.yml

jobs:
  github-config:
    runs-on: ubuntu-latest
    name: Apply GitHub config
    environment: config 
    steps:
      - name: Apply Github Config
        uses: morten-olsen/github-config@main
        with:
          github-token: "${{ secrets.GH_TOKEN }}"

And that is it, now you can start to configure your repo by changing the .github/repo.yml, and ensure all you repos are using the same setup by reusing the same configuration file across all projects

Road map

  • GitHub Action
  • Initial configuration format
  • Ability to configure general settings and branch protections
  • Finalize configuration format
  • Support all configurations exposed in the API
  • CLI tool
    • Validate config
    • Apply config
    • Enroll repo
  • Programatic usage
  • Documentation
  • Support downloading config from another repository

Example of a hardened GitHub setup with GitHub Config

TODO