Giter Club home page Giter Club logo

github-action-repo-settings-sync's Introduction

github-action-repo-settings-sync

Github Action to setup repositories settings and keep them in sync

version

Use Cases

Great for keeping repository settings in sync across all repos. I constantly forget when creating new repos to go tweak all my repository settings how I like them, set up branch policies, etc. This allows me to add my new repo to the list (or just take the default of all and have no steps) and automatically have my settings there.

Setup

Create a new file called /.github/workflows/repo-settings-sync.yml that looks like so:

name: Repo Setup

on:
  push:
    branches:
      - master
  schedule:
    - cron: 0 0 * * *

jobs:
  repo_setup:
    runs-on: ubuntu-latest
    steps:
      - name: Repo Setup
        uses: kbrashears5/[email protected]
        with:
          REPOSITORIES: |
            kbrashears5/github-action-repo-settings-sync
          ALLOW_ISSUES: 'true'
          ALLOW_PROJECTS: 'true'
          ALLOW_WIKI: 'true'
          SQUASH_MERGE: 'true'
          MERGE_COMMIT: 'true'
          REBASE_MERGE: 'true'
          AUTO_MERGE: 'false'
          DELETE_HEAD: 'false'
          BRANCH_PROTECTION_ENABLED: 'true'
          BRANCH_PROTECTION_NAME: 'main'
          BRANCH_PROTECTION_REQUIRED_REVIEWERS: '1'
          BRANCH_PROTECTION_DISMISS: 'true'
          BRANCH_PROTECTION_CODE_OWNERS: 'true'
          BRANCH_PROTECTION_ENFORCE_ADMINS: 'false'
          TOKEN: ${{ secrets.ACTIONS }}

Parameters

Parameter Required Default Description
TOKEN true Personal Access Token with Repo scope
REPOSITORIES false 'ALL' Github repositories to setup. Default will get all public repositories for your username
ALLOW_ISSUES false true Whether or not to allow issues on the repo
ALLOW_PROJECTS false true Whether or not to allow projects on the repo
ALLOW_WIKI false true Whether or not to allow wiki on the repo
SQUASH_MERGE false true Whether or not to allow squash merges on the repo
MERGE_COMMIT false true Whether or not to allow merge commits on the repo
REBASE_MERGE false true Whether or not to allow rebase merges on the repo
AUTO_MERGE false false Whether or not to allow auto-merge on the repo
DELETE_HEAD false false Whether or not to delete head branch after merges
BRANCH_PROTECTION_ENABLED false false Whether or not to enable branch protection. 'true' will overwrite any existing rules, while 'false' will remove branch protection rules. Use 'UNCHANGED' to avoid changing rules.
BRANCH_PROTECTION_NAME false 'master' Branch name pattern for branch protection rule
BRANCH_PROTECTION_REQUIRED_REVIEWERS false 1 Number of required reviewers for branch protection rule
BRANCH_PROTECTION_DISMISS false true Dismiss stale pull request approvals when new commits are pushed
BRANCH_PROTECTION_CODE_OWNERS false true Require review from Code Owners
BRANCH_PROTECTION_ENFORCE_ADMINS false false Enforce branch protection rules for repo admins

github-action-repo-settings-sync's People

Contributors

domdomegg avatar github-actions[bot] avatar kbrashears5 avatar tenshiamd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

github-action-repo-settings-sync's Issues

Add support for more repo settings

The settings I would like to be able to control are:

Repo level

  • Require contributors to sign off on web-based commits
  • Always suggest updating pull request branches

Branch protection level

  • Dismiss stale pull request approvals when new commits are pushed
  • Require approval from someone other than the last pusher
  • Require conversation resolution before merging
  • Require signed commits
  • Require linear history

But in general it would be best if this contained all possible settings

Implement remove all or individually unselect settings for branch protection

I suggest that we have more control over the settings for branch protection, I suggest having options like BRANCH_PROTECTION: true (default: false - if false will remove the branch protection) and for other options, if the setting will have null as a value it should somehow unselect the specific settings regarding branch protection. @kbrashears5 what do you think? please let us know. Thank you.

Ability to configure multiple branch protection rules

This is a really great action! Thanks for making it. Any plans to add support for multiple branch protection rules? Our use case would be to add one for the main branch, and another for our staging branch with differing rules between them.

Implement options to exclude a list of repositories

Greetings! I would like to request an option to exclude a list of repositories. The use case is sometimes we would like set up other repositories with different settings (using an individual developer or an organization). I might work on a PR on my free time regarding this matter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.