Created
November 14, 2015 10:39
-
-
Save rufer7/55168303927d45604d8e to your computer and use it in GitHub Desktop.
Automated GitHub repositorycreation for d-fens GmbH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires -Modules biz.dfch.PS.System.Utilities | |
$token = ''; | |
$username = ''; | |
$repositoryName = ''; | |
$repositoryDescription = ''; | |
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$token))); | |
Invoke-RestMethod -Uri https://api.github.com/orgs/dfensgmbh/repos -Credential $base64AuthInfo; | |
# DFTODO - Get available templates from GET /gitignore/templates | |
# DFTODO - Get available licenses from GET /licenses | |
# Create repo | |
$body = @{name=$repositoryName;description=$repositoryDescription;private=$false;has_issues=$true;has_wiki=$true;has_downloads=$true;auto_init=$true;gitignore_template="VisualStudio";license_template="apache-2.0"} | ConvertTo-Json -Compress; | |
Invoke-RestMethod -Uri https://api.github.com/orgs/dfensgmbh/repos -Headers @{"Authorization"="Basic $base64AuthInfo"} -Method Post -Body $body; | |
# DFTODO - Add license badge to README ([![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://github.com/dfensgmbh/biz.dfch.CS.OData.OAuth/blob/master/LICENSE)) | |
# Do this with git | |
# Create labels | |
$body = @{name="feature";color="fbca04"} | ConvertTo-Json -Compress; | |
Invoke-RestMethod -Uri https://api.github.com/repos/dfensgmbh/biz.dfch.CS.CIMI.Client/labels -Headers @{"Authorization"="Basic $base64AuthInfo"} -Method Post -Body $body; | |
$body = @{name="onhold";color="fad8c7"} | ConvertTo-Json -Compress; | |
Invoke-RestMethod -Uri https://api.github.com/repos/dfensgmbh/biz.dfch.CS.CIMI.Client/labels -Headers @{"Authorization"="Basic $base64AuthInfo"} -Method Post -Body $body; | |
$body = @{name="task";color="0052cc"} | ConvertTo-Json -Compress; | |
Invoke-RestMethod -Uri https://api.github.com/repos/dfensgmbh/biz.dfch.CS.CIMI.Client/labels -Headers @{"Authorization"="Basic $base64AuthInfo"} -Method Post -Body $body; | |
# DFTODO - Create NOTICE (read sample file and replace escaped text sections with real text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment