Repository navigation
1079 lines (969 loc) · 44.3 KB
/
Copy pathregistration.yml
File metadata and controls
1079 lines (969 loc) · 44.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Registration - Welcome & CSV Export
on:
issues:
types: [opened]
workflow_dispatch:
permissions:
contents: write
issues: write
# Needed to dispatch the provisioning workflow when an enrollment lands.
actions: write
jobs:
classroom-enrollment:
name: Classroom Enrollment - Fast Path
runs-on: ubuntu-latest
if: >-
github.event_name == 'issues' &&
github.event.action == 'opened' &&
contains(github.event.issue.title, '[ENROLL]')
steps:
- name: Check for duplicate classroom enrollment
id: dup-check
uses: actions/github-script@v8
with:
script: |
const username = context.payload.issue.user.login;
const currentIssueNumber = context.issue.number;
const existingIssues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'classroom-enrollment',
state: 'all',
per_page: 100
});
const priorEnrollment = existingIssues.find(
issue => issue.user.login === username && issue.number !== currentIssueNumber
);
if (priorEnrollment) {
core.setOutput('is_duplicate', 'true');
core.setOutput('original_issue', priorEnrollment.number.toString());
} else {
core.setOutput('is_duplicate', 'false');
}
- name: Handle duplicate classroom enrollment
if: steps.dup-check.outputs.is_duplicate == 'true'
uses: actions/github-script@v8
env:
ORIGINAL_ISSUE: ${{ steps.dup-check.outputs.original_issue }}
with:
script: |
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
const value = match[1].trim();
if (value === '_No response_') return '';
return value;
}
const body = context.payload.issue.body || '';
const displayName = parseField(body, 'Full Name') || 'there';
const duplicateBodyLines = [
'## You are already enrolled',
'',
`Hi ${displayName}, it looks like you already submitted enrollment in #${process.env.ORIGINAL_ISSUE}.`,
'',
'No action needed. Your original enrollment remains active. If you have not received',
'your learning room invitation yet, check your GitHub notifications, or ask for help:',
'- https://github.com/Community-Access/support/issues',
'',
'## Where to see replies',
'- GitHub notification bell',
'- Email notifications for this issue thread'
];
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: duplicateBodyLines.join('\n')
});
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['duplicate']
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
state: 'closed',
state_reason: 'not_planned'
});
- name: Guardrail - validate private storage configuration
id: storage-guardrail
if: steps.dup-check.outputs.is_duplicate == 'false'
uses: actions/github-script@v8
env:
PRIVATE_STUDENT_DATA_REPO: ${{ vars.PRIVATE_STUDENT_DATA_REPO }}
PRIVATE_STUDENT_DATA_TOKEN: ${{ secrets.PRIVATE_STUDENT_DATA_TOKEN }}
with:
script: |
const targetRepo = (process.env.PRIVATE_STUDENT_DATA_REPO || '').trim();
const token = (process.env.PRIVATE_STUDENT_DATA_TOKEN || '').trim();
const hasRepo = targetRepo.includes('/');
const hasToken = token.length > 0;
const configured = hasRepo && hasToken;
core.setOutput('configured', configured ? 'true' : 'false');
if (!configured) {
const missing = [];
if (!hasRepo) missing.push('PRIVATE_STUDENT_DATA_REPO (owner/repo)');
if (!hasToken) missing.push('PRIVATE_STUDENT_DATA_TOKEN');
core.setOutput('missing', missing.join(', '));
}
- name: Handle missing private storage config
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'false'
uses: actions/github-script@v8
env:
MISSING_CONFIG: ${{ steps.storage-guardrail.outputs.missing }}
with:
script: |
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: [
'## Enrollment submission (redacted)',
'',
'- Status: blocked (admin configuration required)',
`- Submitted by: @${context.payload.issue.user.login}`,
`- Processed at: ${new Date().toISOString()}`
].join('\n')
});
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: [
'## Enrollment is temporarily unavailable',
'',
'Our secure intake backend is not fully configured yet.',
`Missing configuration: ${process.env.MISSING_CONFIG || 'unknown'}`,
'',
'A facilitator has been notified. Please try again soon.'
].join('\n')
});
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['admin-config-required']
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
state: 'closed',
state_reason: 'not_planned'
});
- name: Fail workflow when private storage config is missing
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'false'
run: |
echo "Required private storage configuration is missing."
exit 1
- name: Parse enrollment fields
id: parse
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'true'
uses: actions/github-script@v8
with:
script: |
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
const value = match[1].trim();
if (value === '_No response_') return '';
return value;
}
const body = context.payload.issue.body || '';
const fullName = parseField(body, 'Full Name');
const email = parseField(body, 'Email Address');
core.setOutput('full_name', fullName);
core.setOutput('email', email);
const missing = [];
if (!fullName) missing.push('Full Name');
if (!email) missing.push('Email Address');
if (missing.length) {
core.setOutput('is_valid', 'false');
core.setOutput('missing_fields', missing.join(', '));
} else {
core.setOutput('is_valid', 'true');
}
- name: Handle missing required values
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'true' &&
steps.parse.outputs.is_valid == 'false'
uses: actions/github-script@v8
env:
MISSING_FIELDS: ${{ steps.parse.outputs.missing_fields }}
with:
script: |
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
const value = match[1].trim();
if (value === '_No response_') return '';
return value;
}
const body = context.payload.issue.body || '';
const displayName = parseField(body, 'Full Name') || 'there';
const missingBodyLines = [
'## We need a quick update before enrollment',
'',
`Hi ${displayName}, we could not process enrollment because some required values were missing: ${process.env.MISSING_FIELDS}.`,
'',
'This usually happens when the issue was created from a different template than the enrollment form, so the name and email questions never appeared.',
'',
'**Easiest fix:** edit this issue and paste the lines below at the top of the issue body, filling in your details:',
'',
'```markdown',
'### Full Name',
'',
'Your Name Here',
'',
'### Email Address',
'',
'you@example.com',
'```',
'',
'To edit: open this issue, find the **Edit** option on the first post (in the `...` menu at the top right of the post), make the change, and select **Update comment**.',
'',
'When you are done, comment `ready` so a facilitator can retry.',
'',
'Prefer to start over instead? Use the enrollment form directly: https://github.com/Community-Access/git-going-with-github/issues/new?template=enrollment.yml&title=%5BENROLL%5D+GIT+Going+with+GitHub'
];
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: missingBodyLines.join('\n')
});
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['needs-info']
});
- name: Store full intake in private student repo (optional)
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'true' &&
steps.parse.outputs.is_valid == 'true' &&
vars.PRIVATE_STUDENT_DATA_REPO != ''
uses: actions/github-script@v8
env:
TARGET_REPO: ${{ vars.PRIVATE_STUDENT_DATA_REPO }}
FULL_NAME: ${{ steps.parse.outputs.full_name }}
EMAIL: ${{ steps.parse.outputs.email }}
with:
github-token: ${{ secrets.PRIVATE_STUDENT_DATA_TOKEN }}
script: |
const target = (process.env.TARGET_REPO || '').trim();
if (!target.includes('/')) {
core.setOutput('stored', 'false');
core.setOutput('reason', 'invalid-target-repo');
return;
}
const [owner, repo] = target.split('/');
const intakeLines = [
'## Classroom Enrollment Intake',
'',
`- Public issue: https://github.com/${context.repo.owner}/${context.repo.repo}/issues/${context.issue.number}`,
`- Submitted by: @${context.payload.issue.user.login}`,
`- Full Name: ${process.env.FULL_NAME || ''}`,
`- Email Address: ${process.env.EMAIL || ''}`,
`- GitHub Experience: ${(context.payload.issue.body || '').match(/### Experience with GitHub\s*\n+([\s\S]*?)(?=\n### |$)/i)?.[1]?.trim() || ''}`,
`- VS Code Experience: ${(context.payload.issue.body || '').match(/### Experience with Visual Studio Code\s*\n+([\s\S]*?)(?=\n### |$)/i)?.[1]?.trim() || ''}`,
`- Course Goals: ${(context.payload.issue.body || '').match(/### What do you hope to get out of this course\?\s*\n+([\s\S]*?)(?=\n### |$)/i)?.[1]?.trim() || ''}`,
'',
`- Captured at: ${new Date().toISOString()}`
];
try {
await github.rest.issues.create({
owner,
repo,
title: `[ENROLL-INTAKE] ${process.env.FULL_NAME || context.payload.issue.user.login}`,
body: intakeLines.join('\n'),
labels: ['intake', 'classroom-enrollment']
});
} catch (error) {
if (error.status === 422) {
await github.rest.issues.create({
owner,
repo,
title: `[ENROLL-INTAKE] ${process.env.FULL_NAME || context.payload.issue.user.login}`,
body: intakeLines.join('\n')
});
} else {
throw error;
}
}
core.setOutput('stored', 'true');
- name: Redact public enrollment issue body after successful validation
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'true' &&
steps.parse.outputs.is_valid == 'true'
uses: actions/github-script@v8
with:
script: |
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: [
'## Enrollment submission (redacted)',
'',
'- Status: accepted for processing',
`- Submitted by: @${context.payload.issue.user.login}`,
`- Processed at: ${new Date().toISOString()}`
].join('\n')
});
- name: Post beginner-friendly success comment
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'true' &&
steps.parse.outputs.is_valid == 'true'
uses: actions/github-script@v8
with:
script: |
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
const value = match[1].trim();
if (value === '_No response_') return '';
return value;
}
const body = context.payload.issue.body || '';
const displayName = parseField(body, 'Full Name') || 'there';
const successBodyLines = [
'## You are enrolled. Welcome!',
`Hi ${displayName}, great job submitting your first step.`,
'',
'## Next steps',
'- Your private learning room repository is being prepared automatically.',
'- Watch for a GitHub repository invitation (notification bell and email). Accept it to open your learning room.',
'- While you wait, start with the Pre-Workshop Setup Guide: https://community-access.github.io/git-going-with-github/docs/00-pre-workshop-setup.html',
'',
'Day 2 content automatically unlocks in your learning room after you complete Day 1 challenges.',
'',
'## Where to see replies',
'- GitHub notification bell',
'- Email notifications for this issue thread',
'',
'Please reply `ack` on this issue after you receive your learning room invitation.',
'Then close this enrollment issue as Challenge 0.',
'',
'If you are already a member of the Community-Access GitHub organization for any other reason, you will not get an invitation email - GitHub grants existing org members instant access instead. If an hour has passed, check your repository list directly for `learning-room-self-paced-2026-<your-username>` before filing a support issue.',
'',
'If you do not receive an invitation within an hour, or you get stuck at any step, open support:',
'- https://github.com/Community-Access/support/issues',
'',
'You belong here.'
];
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: successBodyLines.join('\n')
});
- name: Trigger learning room provisioning
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'true' &&
steps.parse.outputs.is_valid == 'true'
uses: actions/github-script@v8
with:
script: |
// Event-driven provisioning: the provisioning workflow also runs on
// a healing-sweep schedule, so a failed dispatch only delays a
// learner, never strands them. Do not fail enrollment over it.
try {
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'provision-learning-rooms.yml',
ref: 'main'
});
console.log('Provisioning workflow dispatched.');
} catch (e) {
console.log(`Could not dispatch provisioning workflow: ${e.message}`);
}
- name: Add enrolled label
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'true' &&
steps.parse.outputs.is_valid == 'true'
uses: actions/github-script@v8
with:
script: |
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['enrolled']
});
- name: Add proficiency-based labels for facilitator triage
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.storage-guardrail.outputs.configured == 'true' &&
steps.parse.outputs.is_valid == 'true'
uses: actions/github-script@v8
with:
script: |
function extractProficiencyLabel(body, field) {
const regex = new RegExp(`### ${field}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return 'unknown';
const value = match[1].trim();
if (value.includes('New') || value.includes('just')) return 'proficiency-beginner';
if (value.includes('Some') || value.includes('learning')) return 'proficiency-intermediate';
if (value.includes('Confident') || value.includes('regularly')) return 'proficiency-advanced';
return 'proficiency-unassessed';
}
const body = context.payload.issue.body || '';
const gitHubLabel = extractProficiencyLabel(body, 'Experience with GitHub');
const vscodeLabel = extractProficiencyLabel(body, 'Experience with Visual Studio Code');
const labelsToAdd = [gitHubLabel, vscodeLabel];
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labelsToAdd
});
welcome:
name: Welcome New Registrant
runs-on: ubuntu-latest
if: >-
github.event_name == 'issues' &&
github.event.action == 'opened' &&
contains(github.event.issue.title, '[REGISTER]')
steps:
- name: Check for duplicate registration
id: dup-check
uses: actions/github-script@v8
with:
script: |
const username = context.payload.issue.user.login;
const currentIssueNumber = context.issue.number;
// Find existing registration issues by this user
const existingIssues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'registration',
state: 'all',
per_page: 100
});
const priorRegistration = existingIssues.find(
issue => issue.user.login === username && issue.number !== currentIssueNumber
);
if (priorRegistration) {
core.setOutput('is_duplicate', 'true');
core.setOutput('original_issue', priorRegistration.number);
} else {
core.setOutput('is_duplicate', 'false');
}
- name: Handle duplicate registration
if: steps.dup-check.outputs.is_duplicate == 'true'
uses: actions/github-script@v8
env:
ORIGINAL_ISSUE: ${{ steps.dup-check.outputs.original_issue }}
with:
script: |
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
const value = match[1].trim();
if (value === '_No response_') return '';
return value;
}
const body = context.payload.issue.body || '';
const firstName = parseField(body, 'First Name');
const lastName = parseField(body, 'Last Name');
const fullName = [firstName, lastName].filter(Boolean).join(' ').trim() || parseField(body, 'Full Name') || parseField(body, 'Name');
const displayName = fullName || 'there';
const originalIssue = parseInt(process.env.ORIGINAL_ISSUE, 10);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `## You are already registered!
Hi ${displayName}, it looks like you already registered in issue #${originalIssue}. No need to register again — your spot is saved!
We have closed this issue since your original registration is already on file. If you need to update your details, please comment on your original issue #${originalIssue}.
Questions? [File a support issue](https://github.com/Community-Access/support/issues) in the support hub.`
});
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['duplicate']
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
state: 'closed',
state_reason: 'not_planned'
});
- name: Check capacity
id: capacity-check
if: steps.dup-check.outputs.is_duplicate == 'false'
uses: actions/github-script@v8
with:
script: |
// Count unique registered users (excluding this issue)
const existingIssues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'registration',
state: 'all',
per_page: 100
});
const currentIssueNumber = context.issue.number;
const uniqueUsers = new Set();
for (const issue of existingIssues) {
if (issue.number !== currentIssueNumber) {
uniqueUsers.add(issue.user.login);
}
}
const currentCount = uniqueUsers.size;
core.setOutput('count', currentCount);
// Registration is currently unlimited.
core.setOutput('is_full', 'false');
- name: Handle registration full
if: steps.dup-check.outputs.is_duplicate == 'false' && steps.capacity-check.outputs.is_full == 'true'
uses: actions/github-script@v8
with:
script: |
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
const value = match[1].trim();
if (value === '_No response_') return '';
return value;
}
const body = context.payload.issue.body || '';
const firstName = parseField(body, 'First Name');
const lastName = parseField(body, 'Last Name');
const fullName = [firstName, lastName].filter(Boolean).join(' ').trim() || parseField(body, 'Full Name') || parseField(body, 'Name');
const displayName = fullName || 'there';
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `## Registration is currently full
Hi ${displayName}, thank you for your interest in GIT Going with GitHub! Unfortunately, all 75 spots have been filled.
We have added you to the waitlist. If a spot opens up, we will let you know right here on this issue.
Questions? [File a support issue](https://github.com/Community-Access/support/issues) in the support hub.`
});
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['waitlist']
});
- name: Post welcome comment
if: steps.dup-check.outputs.is_duplicate == 'false' && steps.capacity-check.outputs.is_full == 'false'
uses: actions/github-script@v8
with:
script: |
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
const value = match[1].trim();
if (value === '_No response_') return '';
return value;
}
const body = context.payload.issue.body || '';
const firstName = parseField(body, 'First Name');
const lastName = parseField(body, 'Last Name');
const fullName = [firstName, lastName].filter(Boolean).join(' ').trim() || parseField(body, 'Full Name') || parseField(body, 'Name');
const displayName = fullName || 'there';
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `## Welcome to GIT Going with GitHub!
Hi ${displayName}, thank you for registering! We are excited to have you join us.
Your registration is confirmed. You can get a head start with the [Pre-Workshop Setup Guide](https://community-access.github.io/git-going-with-github/docs/00-pre-workshop-setup.html).
## Where replies appear
- GitHub notification bell
- Email notifications for this issue thread
If you have any questions, use the support hub:
- Issues: https://github.com/Community-Access/support/issues
- Discussions: https://github.com/Community-Access/support/discussions
You belong here.`
});
- name: Add registration label
if: steps.dup-check.outputs.is_duplicate == 'false' && steps.capacity-check.outputs.is_full == 'false'
uses: actions/github-script@v8
with:
script: |
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['registration']
});
} catch (e) {
console.log('Label may already exist:', e.message);
}
# PII hygiene: this is a public repository. Mirror the [ENROLL] pattern -
# store the full intake privately, then redact the public issue body so
# names and email addresses do not live in public issues indefinitely.
- name: Store registration intake in private repo
id: store-intake
if: >-
steps.dup-check.outputs.is_duplicate == 'false' &&
steps.capacity-check.outputs.is_full == 'false' &&
vars.PRIVATE_STUDENT_DATA_REPO != ''
uses: actions/github-script@v8
env:
TARGET_REPO: ${{ vars.PRIVATE_STUDENT_DATA_REPO }}
with:
github-token: ${{ secrets.PRIVATE_STUDENT_DATA_TOKEN }}
script: |
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
const value = match[1].trim();
if (value === '_No response_') return '';
return value;
}
const target = (process.env.TARGET_REPO || '').trim();
if (!target.includes('/')) {
core.setOutput('stored', 'false');
return;
}
const body = context.payload.issue.body || '';
const firstName = parseField(body, 'First Name');
const lastName = parseField(body, 'Last Name');
const [owner, repo] = target.split('/');
const intakeLines = [
'## Workshop Registration Intake',
'',
`- Public issue: https://github.com/${context.repo.owner}/${context.repo.repo}/issues/${context.issue.number}`,
`- Submitted by: @${context.payload.issue.user.login}`,
`- First Name: ${firstName}`,
`- Last Name: ${lastName}`,
`- Email Address: ${parseField(body, 'Email Address')}`,
`- GitHub Proficiency Level: ${parseField(body, 'GitHub Proficiency Level')}`,
`- Primary Screen Reader: ${parseField(body, 'Primary Screen Reader')}`,
`- Questions or Accommodations: ${parseField(body, 'Questions or Accommodations')}`,
'',
`- Captured at: ${new Date().toISOString()}`
];
try {
await github.rest.issues.create({
owner,
repo,
title: `[REGISTER-INTAKE] ${[firstName, lastName].filter(Boolean).join(' ') || context.payload.issue.user.login}`,
body: intakeLines.join('\n')
});
core.setOutput('stored', 'true');
} catch (error) {
console.log(`Could not store private intake: ${error.message}`);
core.setOutput('stored', 'false');
}
# Only redact once the data is safely captured privately; otherwise leave
# the issue as-is so no information is lost.
- name: Redact public registration issue body
if: steps.store-intake.outputs.stored == 'true'
uses: actions/github-script@v8
with:
script: |
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: [
'## Registration submission (redacted)',
'',
'- Status: accepted',
`- Submitted by: @${context.payload.issue.user.login}`,
`- Processed at: ${new Date().toISOString()}`
].join('\n')
});
export-csv:
name: Export Registrations to CSV
runs-on: ubuntu-latest
if: >-
((github.event_name == 'workflow_dispatch') ||
(github.event_name == 'issues' &&
github.event.action == 'opened' &&
contains(github.event.issue.title, '[REGISTER]'))) &&
vars.ENABLE_PUBLIC_REGISTRATION_EXPORT == 'true'
steps:
- name: Generate CSV from registration issues
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
// Fetch all issues with the registration label
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'registration',
state: 'all',
per_page: 100
});
// Parse issue body fields (GitHub YAML forms use ### heading + content pattern)
function parseField(body, fieldName) {
if (!body) return '';
// Match the pattern: ### Field Name\n\nValue
// Also handle ### Field Name\r\n\r\nValue
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
let value = match[1].trim();
// Remove _No response_ placeholder
if (value === '_No response_') return '';
// Escape CSV: quote fields containing commas, quotes, or newlines
if (value.includes(',') || value.includes('"') || value.includes('\n')) {
value = '"' + value.replace(/"/g, '""') + '"';
}
return value;
}
// Fetch org members and pending invitations for OrgStatus column
let orgMembers = new Set();
let pendingInvites = new Set();
try {
const members = await github.paginate(github.rest.orgs.listMembers, {
org: context.repo.owner,
per_page: 100
});
for (const m of members) orgMembers.add(m.login.toLowerCase());
const invites = await github.paginate(github.rest.orgs.listPendingInvitations, {
org: context.repo.owner,
per_page: 100
});
for (const inv of invites) {
if (inv.login) pendingInvites.add(inv.login.toLowerCase());
}
} catch (e) {
console.log('Could not fetch org membership (may lack admin scope):', e.message);
}
// Build CSV
const headers = [
'IssueNumber',
'State',
'CreatedAt',
'GitHubUsername',
'FirstName',
'LastName',
'Email',
'ProficiencyLevel',
'PrimaryScreenReader',
'QuestionsOrAccommodations',
'OrgStatus'
];
let csv = headers.join(',') + '\n';
// Deduplicate by GitHub username, keeping only the earliest registration
const seen = new Set();
const sortedIssues = issues.sort((a, b) => new Date(a.created_at) - new Date(b.created_at));
for (const issue of sortedIssues) {
const username = issue.user.login;
if (seen.has(username)) continue;
seen.add(username);
// Determine org membership status
const uLower = username.toLowerCase();
let orgStatus = 'needs-invite';
if (orgMembers.has(uLower)) orgStatus = 'member';
else if (pendingInvites.has(uLower)) orgStatus = 'pending';
const row = [
issue.number,
issue.state.toUpperCase(),
issue.created_at.split('T')[0],
username,
parseField(issue.body, 'First Name'),
parseField(issue.body, 'Last Name'),
parseField(issue.body, 'Email Address'),
parseField(issue.body, 'GitHub Proficiency Level'),
parseField(issue.body, 'Primary Screen Reader'),
parseField(issue.body, 'Questions or Accommodations'),
orgStatus
];
csv += row.join(',') + '\n';
}
// Write CSV file
fs.mkdirSync('.github/data', { recursive: true });
fs.writeFileSync('.github/data/registration-data.csv', csv, 'utf-8');
console.log(`Exported ${seen.size} unique registration(s) from ${issues.length} total issue(s) to .github/data/registration-data.csv`);
- name: Upload CSV as artifact
uses: actions/upload-artifact@v4
with:
name: registration-data
path: .github/data/registration-data.csv
retention-days: 90
export-classroom-intake:
name: Export Classroom Intake to CSV
runs-on: ubuntu-latest
if: >-
((github.event_name == 'workflow_dispatch') ||
(github.event_name == 'issues' &&
github.event.action == 'opened' &&
contains(github.event.issue.title, '[ENROLL]'))) &&
vars.ENABLE_PUBLIC_CLASSROOM_INTAKE_EXPORT == 'true'
steps:
- name: Generate CSV from classroom enrollment issues
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'classroom-enrollment',
state: 'all',
per_page: 100
});
function parseField(body, fieldName) {
if (!body) return '';
const regex = new RegExp(`### ${fieldName}\\s*\\n+([\\s\\S]*?)(?=\\n### |$)`, 'i');
const match = body.match(regex);
if (!match) return '';
let value = match[1].trim();
if (value === '_No response_') return '';
if (value.includes(',') || value.includes('"') || value.includes('\n')) {
value = '"' + value.replace(/"/g, '""') + '"';
}
return value;
}
const headers = [
'IssueNumber',
'State',
'CreatedAt',
'SubmittedByGitHubLogin',
'FullName',
'EmailAddress',
'GitHubExperience',
'VSCodeExperience',
'CourseGoals'
];
let csv = headers.join(',') + '\n';
const seen = new Set();
const sortedIssues = issues.sort((a, b) => new Date(a.created_at) - new Date(b.created_at));
for (const issue of sortedIssues) {
const login = issue.user.login;
if (seen.has(login)) continue;
seen.add(login);
const row = [
issue.number,
issue.state.toUpperCase(),
issue.created_at.split('T')[0],
login,
parseField(issue.body, 'Full Name'),
parseField(issue.body, 'Email Address'),
parseField(issue.body, 'Experience with GitHub'),
parseField(issue.body, 'Experience with Visual Studio Code'),
parseField(issue.body, 'What do you hope to get out of this course?')
];
csv += row.join(',') + '\n';
}
fs.mkdirSync('.github/data', { recursive: true });
fs.writeFileSync('.github/data/classroom-intake.csv', csv, 'utf-8');
console.log(`Exported ${seen.size} unique classroom enrollment issue(s) from ${issues.length} total issue(s)`);
- name: Upload classroom intake CSV as artifact
uses: actions/upload-artifact@v4
with:
name: classroom-intake-data
path: .github/data/classroom-intake.csv
retention-days: 90
sync-roster:
name: Sync Student Roster (No PII)
runs-on: ubuntu-latest
if: >-
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'issues' &&
github.event.action == 'opened' &&
contains(github.event.issue.title, '[REGISTER]'))
steps: