Skip to content

Instantly share code, notes, and snippets.

@felixfbecker
Last active January 31, 2020 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felixfbecker/5d34177ba05e43e078df7c2b8be1817e to your computer and use it in GitHub Desktop.
Save felixfbecker/5d34177ba05e43e078df7c2b8be1817e to your computer and use it in GitHub Desktop.
Automation for sending out coding exercises
#Requires -Modules PSGitHub, PSGSuite
function New-CodingExercise {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string] $CandidateUsername,
[Parameter(Mandatory)]
[string] $CandidateName,
[Parameter(Mandatory)]
[string] $CandidateEmail,
[Parameter(Mandatory)]
[string] $Interview
)
process {
$repo = Copy-GitHubTemplateRepository `
-Owner sourcegraph `
-Name "coding-exercise-$CandidateName" `
-TemplateOwner sourcegraph `
-TemplateName "interview-$Interview" `
-Private
$repo | Add-GitHubRepositoryCollaborator -Username $CandidateUsername | Out-Null
$body = "
Hi $CandidateName!
Here's the link to your coding exercise: $($repo.HtmlUrl)
- Nick
"
Send-GmailMessage -Subject "Coding Exercise" -Body $body -To $CandidateEmail
}
}
function Close-CodingExercise {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string] $CandidateUsername,
[Parameter(Mandatory)]
[string] $CandidateName,
[Parameter(Mandatory)]
[string] $CandidateEmail,
[Parameter(Mandatory)],
[string[]] $Reviewers
)
process {
$repo = @{
Owner = 'sourcegraph'
RepositoryName = "coding-exercise-$CandidateName"
}
Remove-GitHubRepositoryCollaborator @repo -Username $CandidateUsername | Out-Null
New-GitHubIssue @repo `
-Title "Review coding exercise" `
-Body "Please submit your feedback to Google Hire." `
-Assignees $Reviewers
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment