Skip to content

Latest commit

 

History

History
95 lines (69 loc) · 2.97 KB

File metadata and controls

95 lines (69 loc) · 2.97 KB

Configuration for new repos

When configuring a new repo consider the following.

Contents

Creating

NOTE: Be careful to follow the github instructions.

gh repo create my_repo --public
mkdir my_repo
git init

Conventional Commits

[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)  

[![Repository](https://skillicons.dev/icons?i=bash,aws,git,linux,vscode)](https://skillicons.dev)

NOTE: This repo has switched to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0). It requires `pre-commit` and `commitizen` to help with controlling this.  
# install pre-commmit (prerequisite for commitizen)
brew install pre-commit
brew install commitizen
# conventional commits extension
code --install-extension vivaxy.vscode-conventional-commits

# install hooks
pre-commit install --hook-type commit-msg --hook-type pre-push

Adding LICENSE file

Click Add File button in github portal. Type in name as LICENSE and choose the template you require.

Adding CODEOWNERS

More info on CODEOWNERS

*           @chrisguest75
.github/*   @chrisguest75

Adding pipelines

Create a ./.github./workflows folder

mkdir -p ./.github./workflows

Adding branch protections

Use graphQL to create branch protections docs

export owner="chrisguest75"
export name="github-of-life"
repositoryId="$(gh api graphql -f query='{repository(owner:"'$owner'",name:"'$name'"){id}}' -q .data.repository.id)"
echo $repositoryId  

# -F for int 
# isAdminEnforced: false means I can override
gh api graphql -f query='mutation($repositoryId:ID!, $branch:String! $requiredReviews:Int!) {  
createBranchProtectionRule(input: {  
isAdminEnforced: false     
repositoryId: $repositoryId  
pattern: $branch  
requiresApprovingReviews: true  
requiredApprovingReviewCount: $requiredReviews 
 }) { clientMutationId }}' -f repositoryId="$repositoryId" -f branch="[main,master]*" -F requiredReviews=1

Resources