Skip to content

Commit ac0e08e

Browse files
Fix formatting and improve welcome message logic
1 parent 0df91bd commit ac0e08e

1 file changed

Lines changed: 52 additions & 46 deletions

File tree

.github/workflows/welcome.yml

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ on:
1010
required: true
1111
type: number
1212

13-
jobs:
13+
jobs:
1414
generate-prep:
15-
if: github.event.label.name == 'scheduled' || github.event_name == 'workflow_dispatch'
15+
if: github.event.label. name == 'scheduled' || github.event_name == 'workflow_dispatch'
1616
runs-on: ubuntu-latest
1717

1818
steps:
@@ -31,30 +31,27 @@ jobs:
3131
3232
- name: Get issue data
3333
id: get-issue
34-
uses: actions/github-script@v7
34+
uses: actions/github-script@v7
3535
with:
36-
script: |
36+
script: |
3737
let issueNumber;
3838
let issue;
3939
4040
if (context.eventName === 'workflow_dispatch') {
41-
// Manual trigger - fetch the issue
4241
issueNumber = ${{ github.event.inputs.issue_number }};
43-
const response = await github.rest.issues.get({
42+
const response = await github. rest.issues.get({
4443
owner: context.repo.owner,
45-
repo: context.repo.repo,
46-
issue_number: issueNumber
44+
repo: context.repo. repo,
45+
issue_number: issueNumber
4746
});
4847
issue = response.data;
4948
} else {
50-
// Label trigger - use the payload
5149
issue = context.payload.issue;
5250
issueNumber = issue.number;
5351
}
5452
55-
core.setOutput('issue_number', issueNumber);
56-
core.setOutput('issue_body', issue.body || '');
57-
core.setOutput('issue_url', issue.html_url);
53+
core. setOutput('issue_number', issueNumber);
54+
core.setOutput('issue_body', issue. body || '');
5855
5956
- name: Generate personalized prep
6057
id: personalize
@@ -69,23 +66,29 @@ jobs:
6966
const body = process.env.ISSUE_BODY || '';
7067
7168
const nameMatch = body.match(/Name\s*\n\s*([^\n]+)/);
72-
const projectMatch = body. match(/Project Name\s*\n\s*([^\n]+)/);
73-
const repoMatch = body. match(/Project Repo Link\s*\n\s*([^\n]+)/);
69+
const projectMatch = body.match(/Project Name\s*\n\s*([^\n]+)/);
70+
const repoMatch = body.match(/Project Repo Link\s*\n\s*([^\n]+)/);
7471
const descMatch = body.match(/Tell us about yourself\s*\n\s*([\s\S]*?)(?=\n###|\n##|$)/);
7572
7673
const guestName = nameMatch ? nameMatch[1].trim() : 'Guest';
7774
const projectName = projectMatch ? projectMatch[1]. trim() : 'their project';
7875
const projectRepo = repoMatch ? repoMatch[1]. trim() : '';
7976
const guestBackground = descMatch ? descMatch[1].trim() : '';
8077
81-
const prompt = `You are a helpful stream coordinator for Open Source Friday. Create a 2-3 sentence personalized welcome message for this guest:
82-
83-
Guest Name: ${guestName}
84-
Project: ${projectName}
85-
Project Repo: ${projectRepo}
86-
Guest Background: ${guestBackground}
87-
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. `;
78+
const prompt = [
79+
'You are a helpful stream coordinator for Open Source Friday.',
80+
'Create a 2-3 sentence personalized welcome message for this guest:',
81+
'',
82+
'Guest Name: ' + guestName,
83+
'Project: ' + projectName,
84+
'Project Repo: ' + projectRepo,
85+
'Guest Background: ' + guestBackground,
86+
'',
87+
'Write a warm, encouraging message that acknowledges their specific project.',
88+
'Show genuine excitement to have them on the stream.',
89+
'Keep it concise and authentic.',
90+
'Do not use markdown formatting or special characters.'
91+
]. join('\n');
8992
9093
let personalizedMessage = '';
9194
let client;
@@ -106,48 +109,51 @@ Write a warm, encouraging message that acknowledges their specific project and s
106109
await session.destroy();
107110
108111
} catch (error) {
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. `;
112+
console.log('Copilot SDK error: ' + error.message);
113+
personalizedMessage = 'We are thrilled to have ' + guestName + ' joining us to talk about ' + projectName + '! This is going to be a fantastic session. ';
111114
112115
} finally {
113116
if (client) {
114-
await client.stop().catch(e => console.log('Cleanup error:', e.message));
117+
await client.stop().catch(function(e) { console.log('Cleanup error:', e.message); });
115118
}
116119
}
117120
118121
core.setOutput('personalized_message', personalizedMessage);
119122
core.setOutput('guest_name', guestName);
120123
121124
- name: Post personalized prep comment
122-
uses: actions/github-script@v7
125+
uses: actions/github-script@v7
123126
env:
124-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125-
PERSONALIZED_MESSAGE: ${{ steps.personalize.outputs.personalized_message }}
127+
GITHUB_TOKEN: ${{ secrets. GITHUB_TOKEN }}
128+
PERSONALIZED_MESSAGE: ${{ steps. personalize.outputs.personalized_message }}
126129
GUEST_NAME: ${{ steps.personalize.outputs.guest_name }}
127-
ISSUE_NUMBER: ${{ steps.get-issue.outputs.issue_number }}
128-
with:
130+
ISSUE_NUMBER: ${{ steps. get-issue.outputs.issue_number }}
131+
with:
129132
script: |
130-
const personalizedMessage = process.env. PERSONALIZED_MESSAGE;
133+
const personalizedMessage = process.env.PERSONALIZED_MESSAGE;
131134
const guestName = process.env. GUEST_NAME;
132135
const issueNumber = parseInt(process.env.ISSUE_NUMBER, 10);
133-
const guideUrl = `${context.payload.repository.html_url}/blob/main/admin/approved-guest.md`;
134-
135-
const comment = `## Welcome to Open Source Friday! 🎉
136-
137-
${personalizedMessage}
138-
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!)
143-
144-
📖 For full preparation guidelines and expectations, see our [complete guest guide](${guideUrl}).
145-
146-
Looking forward to your session! `;
136+
const repoUrl = context.payload.repository.html_url;
137+
const guideUrl = repoUrl + '/blob/main/admin/approved-guest.md';
138+
139+
const comment = [
140+
'## Welcome to Open Source Friday! 🎉',
141+
'',
142+
personalizedMessage,
143+
'',
144+
'### Quick Prep Checklist',
145+
'- Stream starts at **1:00 PM ET** on your scheduled Friday',
146+
'- Please join at **12:45 PM ET** for tech checks',
147+
'- Have your demo ready to go (live demos are our audience favorite!)',
148+
'',
149+
'For full preparation guidelines and expectations, see our [complete guest guide](' + guideUrl + ').',
150+
'',
151+
'Looking forward to your session!'
152+
].join('\n');
147153
148154
await github.rest.issues.createComment({
149155
issue_number: issueNumber,
150156
owner: context.repo.owner,
151-
repo: context.repo.repo,
157+
repo: context.repo. repo,
152158
body: comment
153159
});

0 commit comments

Comments
 (0)