Skip to content

Commit b2917f2

Browse files
authored
Merge pull request #23 from githubschool/ncalteen/external
Add support for external instructors
2 parents 82b0270 + 89fbd50 commit b2917f2

34 files changed

+963
-2335
lines changed

.eslintrc.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/create-class.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,6 @@ body:
4747
placeholder: '2024-01-15'
4848
validations:
4949
required: true
50-
- type: textarea
51-
id: administrators
52-
attributes:
53-
label: Administrators
54-
description:
55-
A list of GitHub handles and emails to add as repository administrators.
56-
This should include anyone who will be delivering or supporting delivery
57-
of this training.
58-
placeholder: |
59-
60-
61-
validations:
62-
required: true
6350
- type: textarea
6451
id: attendees
6552
attributes:

.github/workflows/process-issue-comment.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ jobs:
1818
if: |
1919
github.event.issue.state == 'open' &&
2020
(
21-
startsWith(github.event.comment.body, '.add-admin') ||
2221
startsWith(github.event.comment.body, '.add-user') ||
23-
startsWith(github.event.comment.body, '.remove-admin') ||
2422
startsWith(github.event.comment.body, '.remove-user')
2523
) &&
2624
contains(github.event.issue.labels.*.name, 'gh-intermediate-class') &&

__tests__/actions.test.ts

Lines changed: 0 additions & 208 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ describe('actions', () => {
128128
customerAbbr: 'NA1',
129129
startDate: new Date(2024, 10, 17),
130130
endDate: new Date(2024, 10, 20),
131-
administrators: [
132-
{
133-
handle: 'ncalteen',
134-
135-
}
136-
],
137131
attendees: [
138132
{
139133
handle: 'ncalteen-testuser',
@@ -164,12 +158,6 @@ describe('actions', () => {
164158
customerAbbr: 'NA1',
165159
startDate: new Date(2024, 10, 17),
166160
endDate: new Date(2024, 10, 20),
167-
administrators: [
168-
{
169-
handle: 'ncalteen',
170-
171-
}
172-
],
173161
attendees: [
174162
{
175163
handle: 'ncalteen-testuser',
@@ -204,12 +192,6 @@ describe('actions', () => {
204192
customerAbbr: 'NA1',
205193
startDate: new Date(2024, 10, 17),
206194
endDate: new Date(2024, 10, 20),
207-
administrators: [
208-
{
209-
handle: 'ncalteen',
210-
211-
}
212-
],
213195
attendees: [
214196
{
215197
handle: 'ncalteen-testuser',
@@ -236,12 +218,6 @@ describe('actions', () => {
236218
customerAbbr: 'NA1',
237219
startDate: new Date(2024, 10, 17),
238220
endDate: new Date(2024, 10, 20),
239-
administrators: [
240-
{
241-
handle: 'ncalteen',
242-
243-
}
244-
],
245221
attendees: [
246222
{
247223
handle: 'ncalteen-testuser',
@@ -265,12 +241,6 @@ describe('actions', () => {
265241
customerAbbr: 'NA1',
266242
startDate: new Date(2024, 10, 17),
267243
endDate: new Date(2024, 10, 20),
268-
administrators: [
269-
{
270-
handle: 'ncalteen',
271-
272-
}
273-
],
274244
attendees: [
275245
{
276246
handle: 'ncalteen-testuser',
@@ -303,12 +273,6 @@ describe('actions', () => {
303273
customerAbbr: 'NA1',
304274
startDate: new Date(2023, 10, 17),
305275
endDate: new Date(2023, 10, 20),
306-
administrators: [
307-
{
308-
handle: 'ncalteen',
309-
310-
}
311-
],
312276
attendees: [
313277
{
314278
handle: 'ncalteen-testuser',
@@ -325,127 +289,6 @@ describe('actions', () => {
325289
})
326290
})
327291

328-
describe('addAdmin()', () => {
329-
it('Throws on Invalid Format', async () => {
330-
try {
331-
await actions.addAdmin(
332-
{
333-
action: AllowedIssueAction.CREATE,
334-
customerName: 'Nick Testing Industries',
335-
customerAbbr: 'NA1',
336-
startDate: new Date(2024, 10, 17),
337-
endDate: new Date(2024, 10, 20),
338-
administrators: [
339-
{
340-
handle: 'ncalteen',
341-
342-
}
343-
],
344-
attendees: [
345-
{
346-
handle: 'ncalteen-testuser',
347-
348-
}
349-
]
350-
},
351-
{
352-
issue: { number: 1 },
353-
comment: {
354-
body: '.add-admin invalid format'
355-
}
356-
} as any
357-
)
358-
} catch (error: any) {
359-
// eslint-disable-next-line jest/no-conditional-expect
360-
expect(error.message).toBe(
361-
'Invalid Format! Try `.add-admin handle,email`'
362-
)
363-
}
364-
})
365-
366-
it('Adds an Admin', async () => {
367-
mocktokit.graphql.mockResolvedValue({
368-
user: {
369-
isEmployee: true,
370-
371-
}
372-
})
373-
374-
await actions.addAdmin(
375-
{
376-
action: AllowedIssueAction.CREATE,
377-
customerName: 'Nick Testing Industries',
378-
customerAbbr: 'NA1',
379-
startDate: new Date(2024, 10, 17),
380-
endDate: new Date(2024, 10, 20),
381-
administrators: [
382-
{
383-
handle: 'ncalteen',
384-
385-
}
386-
],
387-
attendees: [
388-
{
389-
handle: 'ncalteen-testuser',
390-
391-
}
392-
]
393-
},
394-
{
395-
issue: { number: 1 },
396-
comment: {
397-
body: '.add-admin ncalteen,[email protected]'
398-
}
399-
} as any
400-
)
401-
402-
expect(teams_addUser).toHaveBeenCalled()
403-
expect(issues_complete).toHaveBeenCalled()
404-
})
405-
406-
it('Throws on Invalid Admin', async () => {
407-
mocktokit.graphql.mockResolvedValue({
408-
user: {
409-
isEmployee: false,
410-
411-
}
412-
})
413-
414-
try {
415-
await actions.addAdmin(
416-
{
417-
action: AllowedIssueAction.CREATE,
418-
customerName: 'Nick Testing Industries',
419-
customerAbbr: 'NA1',
420-
startDate: new Date(2024, 10, 17),
421-
endDate: new Date(2024, 10, 20),
422-
administrators: [
423-
{
424-
handle: 'ncalteen',
425-
426-
}
427-
],
428-
attendees: [
429-
{
430-
handle: 'ncalteen-testuser',
431-
432-
}
433-
]
434-
},
435-
{
436-
issue: { number: 1 },
437-
comment: {
438-
body: '.add-admin fakeuser,[email protected]'
439-
}
440-
} as any
441-
)
442-
} catch (error: any) {
443-
// eslint-disable-next-line jest/no-conditional-expect
444-
expect(error.message).toBe('Admins Must be GitHub/Microsoft Employees')
445-
}
446-
})
447-
})
448-
449292
describe('addUser()', () => {
450293
it('Throws on Invalid Format', async () => {
451294
try {
@@ -456,12 +299,6 @@ describe('actions', () => {
456299
customerAbbr: 'NA1',
457300
startDate: new Date(2024, 10, 17),
458301
endDate: new Date(2024, 10, 20),
459-
administrators: [
460-
{
461-
handle: 'ncalteen',
462-
463-
}
464-
],
465302
attendees: [
466303
{
467304
handle: 'ncalteen-testuser',
@@ -492,12 +329,6 @@ describe('actions', () => {
492329
customerAbbr: 'NA1',
493330
startDate: new Date(2024, 10, 17),
494331
endDate: new Date(2024, 10, 20),
495-
administrators: [
496-
{
497-
handle: 'ncalteen',
498-
499-
}
500-
],
501332
attendees: [
502333
{
503334
handle: 'ncalteen-testuser',
@@ -519,43 +350,4 @@ describe('actions', () => {
519350
expect(issues_complete).toHaveBeenCalled()
520351
})
521352
})
522-
523-
describe('removeAdmin()', () => {
524-
it('Throws on Invalid Format', async () => {
525-
try {
526-
await actions.removeAdmin(
527-
{
528-
action: AllowedIssueAction.CREATE,
529-
customerName: 'Nick Testing Industries',
530-
customerAbbr: 'NA1',
531-
startDate: new Date(2024, 10, 17),
532-
endDate: new Date(2024, 10, 20),
533-
administrators: [
534-
{
535-
handle: 'ncalteen',
536-
537-
}
538-
],
539-
attendees: [
540-
{
541-
handle: 'ncalteen-testuser',
542-
543-
}
544-
]
545-
},
546-
{
547-
issue: { number: 1 },
548-
comment: {
549-
body: '.remove-admin invalid format'
550-
}
551-
} as any
552-
)
553-
} catch (error: any) {
554-
// eslint-disable-next-line jest/no-conditional-expect
555-
expect(error.message).toBe(
556-
'Invalid Format! Try `.remove-admin handle,email`'
557-
)
558-
}
559-
})
560-
})
561353
})

__tests__/events.test.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,6 @@ describe('events', () => {
5454
).toBe(undefined)
5555
})
5656

57-
it('Returns Add Admin Action for .add-admin Issue Comment Events', () => {
58-
expect(
59-
events.getAction('issue_comment', {
60-
action: 'created',
61-
comment: {
62-
body: '.add-admin handle,email'
63-
}
64-
} as any)
65-
).toBe(AllowedIssueCommentAction.ADD_ADMIN)
66-
})
67-
6857
it('Returns Add User for .add-user Issue Comment Events', () => {
6958
expect(
7059
events.getAction('issue_comment', {
@@ -76,17 +65,6 @@ describe('events', () => {
7665
).toBe(AllowedIssueCommentAction.ADD_USER)
7766
})
7867

79-
it('Returns Remove Admin for .remove-admin Issue Comment Events', () => {
80-
expect(
81-
events.getAction('issue_comment', {
82-
action: 'created',
83-
comment: {
84-
body: '.remove-admin handle,email'
85-
}
86-
} as any)
87-
).toBe(AllowedIssueCommentAction.REMOVE_ADMIN)
88-
})
89-
9068
it('Returns Remove User for .remove-user Issue Comment Events', () => {
9169
expect(
9270
events.getAction('issue_comment', {

0 commit comments

Comments
 (0)