11name : Guest Welcome Bot
22
3- on :
3+ on :
44 issues :
55 types : [labeled]
6+ workflow_dispatch :
7+ inputs :
8+ issue_number :
9+ description : ' Issue number to test with'
10+ required : true
11+ type : number
612
713jobs :
8- generate-prep :
9- if : github.event.label.name == 'scheduled'
14+ generate-prep :
15+ if : github.event.label.name == 'scheduled' || github.event_name == 'workflow_dispatch'
1016 runs-on : ubuntu-latest
1117
12- steps :
13- - name : Checkout repository
18+ steps :
19+ - name : Checkout repository
1420 uses : actions/checkout@v4
1521
1622 - name : Setup Node.js
1723 uses : actions/setup-node@v4
1824 with :
19- node-version : ' 22'
25+ node-version : ' 22'
2026
21- - name : Install Copilot CLI and SDK
22- run : |
27+ - name : Install Copilot CLI and SDK
28+ run : |
2329 npm install -g @github/copilot
2430 npm install @github/copilot-sdk
2531
32+ - name : Get issue data
33+ id : get-issue
34+ uses : actions/github-script@v7
35+ with :
36+ script : |
37+ let issueNumber;
38+ let issue;
39+
40+ if (context.eventName === 'workflow_dispatch') {
41+ // Manual trigger - fetch the issue
42+ issueNumber = ${{ github.event.inputs.issue_number }};
43+ const response = await github.rest.issues.get({
44+ owner: context.repo.owner,
45+ repo: context.repo.repo,
46+ issue_number: issueNumber
47+ });
48+ issue = response.data;
49+ } else {
50+ // Label trigger - use the payload
51+ issue = context.payload.issue;
52+ issueNumber = issue.number;
53+ }
54+
55+ core.setOutput('issue_number', issueNumber);
56+ core.setOutput('issue_body', issue.body || '');
57+ core.setOutput('issue_url', issue.html_url);
58+
2659 - name : Generate personalized prep
2760 id : personalize
2861 uses : actions/github-script@v7
29- env :
62+ env :
3063 GH_TOKEN : ${{ secrets.COPILOT_PAT }}
31- with :
64+ ISSUE_BODY : ${{ steps.get-issue.outputs.issue_body }}
65+ with :
3266 script : |
3367 const { CopilotClient } = require('@github/copilot-sdk');
3468
35- const issue = context.payload. issue;
36- const body = issue.body || '';
69+ const body = process.env.ISSUE_BODY || '';
3770
3871 const nameMatch = body.match(/Name\s*\n\s*([^\n]+)/);
39- const projectMatch = body.match(/Project Name\s*\n\s*([^\n]+)/);
72+ const projectMatch = body. match(/Project Name\s*\n\s*([^\n]+)/);
4073 const repoMatch = body. match(/Project Repo Link\s*\n\s*([^\n]+)/);
4174 const descMatch = body.match(/Tell us about yourself\s*\n\s*([\s\S]*?)(?=\n###|\n##|$)/);
4275
4376 const guestName = nameMatch ? nameMatch[1].trim() : 'Guest';
44- const projectName = projectMatch ? projectMatch[1].trim() : 'their project';
45- const projectRepo = repoMatch ? repoMatch[1].trim() : '';
77+ const projectName = projectMatch ? projectMatch[1]. trim() : 'their project';
78+ const projectRepo = repoMatch ? repoMatch[1]. trim() : '';
4679 const guestBackground = descMatch ? descMatch[1].trim() : '';
4780
48- const prompt = `You are a helpful stream coordinator for Open Source Friday. Create a 2-3 sentence personalized welcome message for this guest:
81+ const prompt = `You are a helpful stream coordinator for Open Source Friday. Create a 2-3 sentence personalized welcome message for this guest:
4982
50- Guest Name: ${guestName}
51- Project: ${projectName}
52- Project Repo: ${projectRepo}
53- Guest Background: ${guestBackground}
83+ Guest Name : ${guestName}
84+ Project : ${projectName}
85+ Project Repo : ${projectRepo}
86+ Guest Background : ${guestBackground}
5487
55- Write a warm, encouraging message that acknowledges their specific project and shows genuine excitement to have them on the stream. Keep it concise and authentic. Do not use markdown formatting or special characters. `;
88+ Write a warm, encouraging message that acknowledges their specific project and shows genuine excitement to have them on the stream. Keep it concise and authentic. Do not use markdown formatting or special characters. `;
5689
5790 let personalizedMessage = '';
5891 let client;
6295 await client.start();
6396
6497 const session = await client.createSession({ model : ' gpt-5' });
65- const response = await session. sendAndWait({ prompt });
98+ const response = await session.sendAndWait({ prompt });
6699
67- if (response?.data?.content) {
100+ if (response?.data?. content) {
68101 personalizedMessage = response.data.content;
69102 } else {
70103 throw new Error('No response content received');
73106 await session.destroy();
74107
75108 } catch (error) {
76- console.log(`Copilot SDK error: ${error. message}`);
77- personalizedMessage = `We're thrilled to have ${guestName} joining us to talk about ${projectName}! This is going to be a fantastic session. `;
109+ console.log(`Copilot SDK error : ${error.message}`);
110+ personalizedMessage = `We're thrilled to have ${guestName} joining us to talk about ${projectName}! This is going to be a fantastic session. `;
78111
79112 } finally {
80113 if (client) {
@@ -91,27 +124,29 @@ jobs:
91124 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92125 PERSONALIZED_MESSAGE : ${{ steps.personalize.outputs.personalized_message }}
93126 GUEST_NAME : ${{ steps.personalize.outputs.guest_name }}
94- with :
127+ ISSUE_NUMBER : ${{ steps.get-issue.outputs.issue_number }}
128+ with :
95129 script : |
96- const personalizedMessage = process.env.PERSONALIZED_MESSAGE;
97- const guestName = process. env.GUEST_NAME;
130+ const personalizedMessage = process.env. PERSONALIZED_MESSAGE;
131+ const guestName = process.env. GUEST_NAME;
132+ const issueNumber = parseInt(process.env.ISSUE_NUMBER, 10);
98133 const guideUrl = `${context.payload.repository.html_url}/blob/main/admin/approved-guest.md`;
99134
100135 const comment = `## Welcome to Open Source Friday! 🎉
101136
102- ${personalizedMessage}
137+ ${personalizedMessage}
103138
104- ### Quick Prep Checklist
105- - Stream starts at **1:00 PM ET** on your scheduled Friday
106- - Please join at **12:45 PM ET** for tech checks
107- - Have your demo ready to go (live demos are our audience's favorite!)
139+ # ## Quick Prep Checklist
140+ - Stream starts at **1:00 PM ET** on your scheduled Friday
141+ - Please join at **12:45 PM ET** for tech checks
142+ - Have your demo ready to go (live demos are our audience's favorite!)
108143
109- 📖 For full preparation guidelines and expectations, see our [complete guest guide](${guideUrl}).
144+ 📖 For full preparation guidelines and expectations, see our [complete guest guide](${guideUrl}).
110145
111- Looking forward to your session! `;
146+ Looking forward to your session! `;
112147
113148 await github.rest.issues.createComment({
114- issue_number: context.issue.number ,
149+ issue_number : issueNumber ,
115150 owner : context.repo.owner,
116151 repo : context.repo.repo,
117152 body : comment
0 commit comments