Marc Rufer 25 Nov 2015 PowerShell GitHub automation
After a longer period of time without blogging I have something interesting for you. In the last few weeks I had to create several GitHub repositories for my daily work. To simplify the process I automated the creation with PowerShell.
I created and initialized the repositories manually until I recognized that this is a perfect task to automate. First I studied the documentation of the GitHub API v3, which is very well documented! Fortunately for me the GitHub API supports all the functions I needed.
The automation contains the following steps:
Apache License 2.0
was selected as licensefeature
, onhold
and task
to the repositoryThe PowerShell script that performs all the steps described above. The script, the corresponding configuration file and the README and NOTICE template can be found in the GitHub repository PS.GitHub.RepoCreator. Feel free to use it and to contribute or create issues for desired use cases.
PS.GitHub.RepoCreator
repositorysrc
folderConfig.xml
: Fill in your GitHub username and the access token generated in step 1NOTICE_Template
: Adjust the content according your wishes (IMPORTANT: The placeholders REPONAME
and REPODESCRIPTION
always have to occur at least once in the file)README_Template
: Adjust the content according your wishes (IMPORTANT: The placeholders REPONAME
, LICENSEBADGE
and REPODESCRIPTION
always have to occur at least once in the file)Apache 2.0
as license, it will add a license badge to the README fileNOTICE_Template
feature
, onhold
, task
Sample invocation
PS C:\PS.GitHub.RepoCreator\src> .\New-GitHubRepo.ps1 -RepoName 'NAME' -RepoDescription 'DESCRIPTION'