Skip to content

Commit 943b99a

Browse files
authored
Merge pull request #213 from Community-Access/chore/harden-learning-room-progression
chore: switch to explicit first-issue seeding fallback
2 parents 9b661c1 + b55c030 commit 943b99a

3 files changed

Lines changed: 22 additions & 132 deletions

File tree

‎admin/qa-bundle/learning-room/.github/workflows/skills-progression.yml‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ on:
1616
description: "Action (check_progress, assign_next, reset)"
1717
required: false
1818
default: "check_progress"
19-
create:
20-
types: [repository]
2119

2220
concurrency:
2321
group: skills-progression-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }}
@@ -164,47 +162,3 @@ jobs:
164162
} catch (error) {
165163
console.error('Error awarding achievement:', error);
166164
}
167-
168-
create-first-issue:
169-
name: Create First Challenge Issue
170-
runs-on: ubuntu-latest
171-
if: github.event_name == 'create'
172-
173-
steps:
174-
- name: Create First Issue
175-
uses: actions/github-script@v7
176-
with:
177-
script: |
178-
const issueTitle = "Welcome to Your First Challenge!";
179-
const issueBody = `
180-
## Your First Challenge
181-
Welcome to the repository! Your first challenge is to complete the following steps:
182-
- [ ] Clone this repository to your local machine.
183-
- [ ] Make a small change to the README file.
184-
- [ ] Commit and push your changes.
185-
- [ ] Open a pull request to merge your changes.
186-
187-
Once you complete these steps, close this issue to unlock the next challenge!
188-
`;
189-
190-
const { data: existingIssues } = await github.rest.issues.listForRepo({
191-
owner: context.repo.owner,
192-
repo: context.repo.repo,
193-
state: 'all',
194-
labels: 'first-issue',
195-
per_page: 100
196-
});
197-
198-
const alreadyExists = existingIssues.some((issue) => issue.title === issueTitle);
199-
if (alreadyExists) {
200-
console.log('First challenge issue already exists. Skipping creation.');
201-
return;
202-
}
203-
204-
await github.rest.issues.create({
205-
owner: context.repo.owner,
206-
repo: context.repo.repo,
207-
title: issueTitle,
208-
body: issueBody,
209-
labels: ['challenge', 'first-issue']
210-
});

‎learning-room/.github/workflows/skills-progression.yml‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ on:
1616
description: "Action (check_progress, assign_next, reset)"
1717
required: false
1818
default: "check_progress"
19-
create:
20-
types: [repository]
2119

2220
concurrency:
2321
group: skills-progression-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }}
@@ -164,47 +162,3 @@ jobs:
164162
} catch (error) {
165163
console.error('Error awarding achievement:', error);
166164
}
167-
168-
create-first-issue:
169-
name: Create First Challenge Issue
170-
runs-on: ubuntu-latest
171-
if: github.event_name == 'create'
172-
173-
steps:
174-
- name: Create First Issue
175-
uses: actions/github-script@v7
176-
with:
177-
script: |
178-
const issueTitle = "Welcome to Your First Challenge!";
179-
const issueBody = `
180-
## Your First Challenge
181-
Welcome to the repository! Your first challenge is to complete the following steps:
182-
- [ ] Clone this repository to your local machine.
183-
- [ ] Make a small change to the README file.
184-
- [ ] Commit and push your changes.
185-
- [ ] Open a pull request to merge your changes.
186-
187-
Once you complete these steps, close this issue to unlock the next challenge!
188-
`;
189-
190-
const { data: existingIssues } = await github.rest.issues.listForRepo({
191-
owner: context.repo.owner,
192-
repo: context.repo.repo,
193-
state: 'all',
194-
labels: 'first-issue',
195-
per_page: 100
196-
});
197-
198-
const alreadyExists = existingIssues.some((issue) => issue.title === issueTitle);
199-
if (alreadyExists) {
200-
console.log('First challenge issue already exists. Skipping creation.');
201-
return;
202-
}
203-
204-
await github.rest.issues.create({
205-
owner: context.repo.owner,
206-
repo: context.repo.repo,
207-
title: issueTitle,
208-
body: issueBody,
209-
labels: ['challenge', 'first-issue']
210-
});

‎scripts/classroom/Test-LearningRoomTemplate.ps1‎

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)