Skip to content

Commit

Permalink
Enable scheduling the provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
rajbos committed Oct 21, 2023
1 parent a4b69aa commit 0d2a8d3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/createExampleRepos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Create Example Repos
on:
workflow_dispatch:

jobs:
create:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run script
shell: pwsh
env:
AZURE_DEVOPS_CREATE_PAT: ${{ secrets.AZURE_DEVOPS_EXT_PAT }}
run: |
.\make.ps1 -command "provision" -provisionCount 5
7 changes: 4 additions & 3 deletions make.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# load the given arguments
param(
[string]$command = "provision"
[string]$command = "provision",
[int] $provisionCount = 1
)

# global settings
Expand Down Expand Up @@ -278,7 +279,7 @@ if ("provision" -eq $command) {
$AccessToken = New-VSTSAuthenticationToken -PersonalAccessToken $env:AZURE_DEVOPS_CREATE_PAT
$project = Get-Project -teamProject $projectName -AccessToken $AccessToken
$createdCount = 0
$maxCount = 1
$maxCount = $provisionCount
while ($createdCount -lt $maxCount) {
# create a random list of generated repo names starting with "ghazdo"
$repoName = "ghazdo-$((Get-Random -Minimum 1000 -Maximum 9999).ToString())"
Expand All @@ -303,6 +304,6 @@ if ("provision" -eq $command) {
}
}
}

Set-Location $PSScriptRoot
# display the current date/time
Get-Date

0 comments on commit 0d2a8d3

Please sign in to comment.