.NET code to create and configure a repo with C#. I'm in GitHub everyday. There are certain activities I found myself manually doing on a regular basis. Not super long activities, but boring, repetitive activities - the types of activities that are perfect for automation. Hence this project:
- Enables repo "auto-merge" open
- Enables repo "Delete head branch on merge" option
- Enables repo visibility to be set
- Creates the initial project.
- Clone the project to a folder (
Target folder
) https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository - Create src folder
- Creates .NET test project (
test project name
andtest project type
) https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new - Creates .NET console\library\webapi\web app project (
project name
andproject type
) https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new - Creates .NET solution (
solution name
) https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-sln
- Clone the project to a folder (
- Creates the GitHub action to build/test/publish the .NET projects added above
- Adds an action status badge to the readme file
- Creates the dependabot configuration
- Push all of the changes back to the repository/GitHub
- Sets up branch policies on default branch (e.g. require a pull request and successful build action)
RepoAutomation [-o|--owner <GITHUB-OWNER/ACCOUNT>]
[-r|--repo <REPOSITORY-NAME>]
[-d|--directory <WORKING-DIRECTORY>]
[-v|--visibility <REPO-VISIBILITY>]
[-p|--projectTypes <.NET-COMMA-DELIMITED-PROJECTS]
Requires a PAT token to be setup, with repo
, workflow
, and delete_repo
(DANGER! DANGER, WILL ROBINSON!!) permissions
Using default settings to create a new repository "RepoAutomationTest", with a .NET 6 class library and unit tests project:
RepoAutomation --owner samsmithnz --repo RepoAutomationTest --directory c:\users\sam\source\repos --visibility public --projectTypes classlib,mstest
For governance, we are building a website to monitor repos and take corrective action: