@@ -64,33 +64,6 @@ function Get-RepositoryFileContent {
6464 )
6565}
6666
67- function Wait-ForIssue {
68- param (
69- [string ]$Repository ,
70- [string ]$TitleContains ,
71- [int ]$MaxAttempts = 18 ,
72- [int ]$DelaySeconds = 5
73- )
74-
75- for ($attempt = 1 ; $attempt -le $MaxAttempts ; $attempt ++ ) {
76- $issues = & gh issue list - R $Repository -- state all -- limit 100 -- json number, title
77- if ($LASTEXITCODE -eq 0 -and $issues ) {
78- $parsed = $issues | ConvertFrom-Json
79- $match = @ ($parsed | Where-Object { $_.title -like " *$TitleContains *" }) | Select-Object - First 1
80- if ($match ) {
81- return $match
82- }
83- }
84-
85- if ($attempt -lt $MaxAttempts ) {
86- Write-Host " Issue '$TitleContains ' not found yet (attempt $attempt /$MaxAttempts ). Retrying in $DelaySeconds seconds..."
87- Start-Sleep - Seconds $DelaySeconds
88- }
89- }
90-
91- throw " Issue containing '$TitleContains ' was not created in time for $Repository ."
92- }
93-
9467$template = " $Owner /$TemplateRepo "
9568$smoke = " $Owner /$SmokeRepo "
9669
@@ -122,24 +95,33 @@ try {
12295 Invoke-CheckedCommand gh @ (' api' , " repos/$smoke /contents/.github/ISSUE_TEMPLATE/challenge-01-find-your-way.yml" )
12396 Invoke-CheckedCommand gh @ (' api' , " repos/$smoke /contents/.github/scripts/challenge-progression.js" )
12497
125- Write-Host " Validating skills progression workflow create trigger and first- issue job ..."
98+ Write-Host " Validating skills progression workflow no longer depends on create-event issue seeding ..."
12699 $skillsWorkflow = Get-RepositoryFileContent - Repository $smoke - Path ' .github/workflows/skills-progression.yml'
127- if ($skillsWorkflow -notmatch ' (?m)^\s{2}create:\s*$' ) {
128- throw " skills-progression.yml is missing 'create' trigger."
129- }
130- if ($skillsWorkflow -notmatch ' (?m)^\s{2}create-first-issue:\s*$' ) {
131- throw " skills-progression.yml is missing create-first-issue job."
100+ if ($skillsWorkflow -match ' (?m)^\s{2}create:\s*$' ) {
101+ throw " skills-progression.yml still contains a 'create' trigger."
132102 }
133- if ($skillsWorkflow -notmatch ' (?m)^\s{4}if:\s+github\.event_name\s*==\s* '' create'' \s*$' ) {
134- throw " create-first-issue job is missing the create-event guard condition ."
103+ if ($skillsWorkflow -match ' (?m)^\s{2} create-first-issue: \s*$' ) {
104+ throw " skills-progression.yml still contains create-first-issue job ."
135105 }
136106
137- Write-Host " Waiting for auto-created first challenge issue..."
138- $firstIssue = Wait-ForIssue - Repository $smoke - TitleContains ' Welcome to Your First Challenge!'
139- Write-Host " Detected first issue #$ ( $firstIssue.number ) : $ ( $firstIssue.title ) "
140-
141107 Write-Host " Triggering Challenge 1 creation..."
142- Invoke-CheckedCommand gh @ (' workflow' , ' run' , ' student-progression.yml' , ' -R' , $smoke , ' -f' , ' start_challenge=1' )
108+ $workflowTriggered = $false
109+ for ($attempt = 1 ; $attempt -le 12 ; $attempt ++ ) {
110+ & gh workflow run ' Student Progression Bot' - R $smoke -f ' start_challenge=1'
111+ if ($LASTEXITCODE -eq 0 ) {
112+ $workflowTriggered = $true
113+ break
114+ }
115+
116+ if ($attempt -lt 12 ) {
117+ Write-Host " Student Progression Bot not ready yet (attempt $attempt /12). Retrying in 5 seconds..."
118+ Start-Sleep - Seconds 5
119+ }
120+ }
121+
122+ if (-not $workflowTriggered ) {
123+ throw " Could not trigger Student Progression Bot in $smoke after multiple attempts."
124+ }
143125
144126 Write-Host " Smoke repo created and workflow triggered. Wait about one minute, then verify:"
145127 Write-Host " gh issue list -R $smoke --search \" Challenge 1 \" "
0 commit comments