Skip to content

Adding TLS 1.2 support #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions GitHubAnalytics.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ function Get-GitHubIssueForRepository
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$issues = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -381,6 +383,8 @@ function Get-GitHubPullRequestForRepository
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$pullRequests = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -640,6 +644,8 @@ function Get-GitHubRepositoryCollaborator
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$collaborators = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -701,6 +707,8 @@ function Get-GitHubRepositoryContributor
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$contributors = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -762,6 +770,8 @@ function Get-GitHubOrganizationMember
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$members = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -819,6 +829,8 @@ function Get-GitHubTeam
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$teams = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -891,6 +903,8 @@ function Get-GitHubTeamMember
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$members = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -949,6 +963,8 @@ function Get-GitHubOrganizationRepository
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$repositories = (ConvertFrom-Json -InputObject $jsonResult.content)
}
Expand Down Expand Up @@ -1010,6 +1026,8 @@ function Get-GitHubRepositoryBranch
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$branches = (ConvertFrom-Json -InputObject $jsonResult.content)
}
Expand Down Expand Up @@ -1091,7 +1109,9 @@ function Get-GitHubAuthenticatedUser
{
$query += "&access_token=$gitHubAccessToken"
}


# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query
$user = ConvertFrom-Json -InputObject $jsonResult.content

Expand Down Expand Up @@ -1197,4 +1217,4 @@ function Get-WeekDate
}

return $beginningsOfWeeks
}
}
15 changes: 14 additions & 1 deletion GitHubLabels.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ function Get-GitHubLabel
{
try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query -Method Get -Headers $headers
$labels = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -92,6 +94,8 @@ function Get-GitHubLabel

try
{
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$jsonResult = Invoke-WebRequest $query -Method Get -Headers $headers
$label = ConvertFrom-Json -InputObject $jsonResult.content
}
Expand Down Expand Up @@ -145,6 +149,9 @@ function New-GitHubLabel
$url = "$script:gitHubApiReposUrl/{0}/{1}/labels" -f $ownerName, $repositoryName

Write-Host "Creating Label:" $labelName

# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$result = Invoke-WebRequest $url -Method Post -Body $data -Headers $headers

if ($result.StatusCode -eq 201)
Expand Down Expand Up @@ -188,6 +195,9 @@ function Remove-GitHubLabel
$url = "$script:gitHubApiReposUrl/{0}/{1}/labels/{2}" -f $ownerName, $repositoryName, $labelName

Write-Host "Deleting Label:" $labelName

# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$result = Invoke-WebRequest $url -Method Delete -Headers $headers

if ($result.StatusCode -eq 204)
Expand Down Expand Up @@ -240,6 +250,9 @@ function Update-GitHubLabel
$url = "$script:gitHubApiReposUrl/{0}/{1}/labels/{2}" -f $ownerName, $repositoryName, $labelName

Write-Host "Updating label '$labelName' to name '$newLabelName' and color '$labelColor'"

# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$result = Invoke-WebRequest $url -Method Patch -Body $data -Headers $headers

if ($result.StatusCode -eq 200)
Expand Down Expand Up @@ -401,4 +414,4 @@ function Get-NextResultPage
{
return $null
}
}
}