From 0d2a8d347146ba68a00cafaa3164c255aa3b4dbc Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 21 Oct 2023 14:22:21 +0200 Subject: [PATCH] Enable scheduling the provisioning --- .github/workflows/createExampleRepos.yml | 16 ++++++++++++++++ make.ps1 | 7 ++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/createExampleRepos.yml diff --git a/.github/workflows/createExampleRepos.yml b/.github/workflows/createExampleRepos.yml new file mode 100644 index 0000000..6807325 --- /dev/null +++ b/.github/workflows/createExampleRepos.yml @@ -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 diff --git a/make.ps1 b/make.ps1 index ceab231..9503adf 100644 --- a/make.ps1 +++ b/make.ps1 @@ -1,6 +1,7 @@ # load the given arguments param( - [string]$command = "provision" + [string]$command = "provision", + [int] $provisionCount = 1 ) # global settings @@ -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())" @@ -303,6 +304,6 @@ if ("provision" -eq $command) { } } } - +Set-Location $PSScriptRoot # display the current date/time Get-Date