Articles
Building an AI-Powered Guest Automation with the Copilot SDK
How I built a GitHub Actions workflow that reads guest submissions and generates personalized welcome messages using the Copilot SDK. The key isn't replacing human attention—it's giving yourself a better starting point.
Building an AI-Powered Guest Automation with the Copilot SDK
Every week on Open Source Friday, we host open source maintainers on our livestream. When a guest gets confirmed, someone on the team labels the issue to kick off an action that writes a welcome message and shares prep instructions. From there, we manually create event posts and design a thumbnail (if you can call my lack of design sensibility that).
The problem? Starting from scratch every time meant we’d fall back to the same template:
“You’re officially scheduled for Open Source Friday! The stream starts at 1:00 PM ET. Please join at 12:45 PM ET for prep and tech checks.”
It worked. But it was boring, and we had better material sitting right there in the issue. Each guest submission included their project details, background, and what they wanted to talk about. We just weren’t using it.
So I built an automation that reads their submission and writes a personalized draft. When a guest mentions they’re excited to talk about their CLI tool that helps developers debug faster, the workflow catches that and generates:
“We can’t wait to hear about your CLI tool and how it’s helping developers debug faster. Your approach to solving this problem sounds like exactly what our audience needs to hear about.”
Not perfect, but a heck of a lot better than starting with a blank comment box.
What I wanted here was not to replace the human attention. Just give us a better starting point.
What it does
A GitHub Actions workflow that triggers when we add the scheduled label to a guest’s issue. It automatically:
- Parses the guest submission (name, GitHub handle, project, and bio)
- Generates a personalized welcome message draft using the Copilot SDK
- Creates a promotional thumbnail using Puppeteer to automate our thumbnail generator
- Posts everything as a scaffolded comment that we can review and personalize further
The automation doesn’t replace the human review. It gives us a draft that already pulls from what they wrote, so we spend our time refining instead of starting from a blank comment box.
Why the Copilot SDK?
I wanted the automation to pull out the interesting bits from each submission and give us a draft that actually sounds human. The Copilot SDK makes this possible without building all the infrastructure myself.
The SDK is in technical preview, and it gives you programmatic access to GitHub Copilot through a simple JavaScript API. No need to deal with raw HTTP requests or wire up authentication yourself.
Here’s what makes it useful:
Multi-turn conversations. Sessions maintain context across multiple requests. If you wanted to build something more complex than a single prompt-response (like a chatbot that remembers previous questions), the SDK handles that.
Custom tools. You can define functions that Copilot can invoke during conversations. For example, you could give it a tool to fetch GitHub issues or query your database, and Copilot decides when to use it.
Lifecycle management. The SDK starts the Copilot CLI, which authenticates using the same mechanisms as the CLI itself (interactive login or environment‑provided tokens such as GH_TOKEN/GITHUB_TOKEN with the right permissions), and then proxies your requests to GitHub Copilot.
For this automation, I’m using the simplest possible pattern: one prompt in, one response out. The prompt does all the heavy lifting:
const promptLines = [
'You are writing on behalf of the Open Source Friday team...',
'',
'Guest details:',
'- Name: ' + guestName,
'- Project: ' + projectName,
'- About them (in their own words): ' + guestBackground,
'',
'Write a 2-3 sentence welcome message that:',
'1. Greets them by name',
'2. Matches their energy — if playful, be playful back; if formal, be warm but professional',
'3. References something specific they said about themselves',
'4. Shows genuine excitement about having them on the stream'
];
That instruction to “match their energy” is what makes the difference. The workflow reads what the guest wrote and mirror their tone back. From there, we tweak if needed or ship it as-is.
The stack
The Copilot SDK is available in Node.js, Python, Go, and .NET. We went with the Node.js implementation since Puppeteer (needed for thumbnail generation) already required Node in the workflow. One runtime, one install step, cleaner setup.
How it works
The Architecture
Guest issue gets "scheduled" label
↓
GitHub Actions workflow triggers
↓
1. Parse issue → extract guest data
2. Copilot SDK → generate personalized message
3. Puppeteer → create thumbnail
4. Post comment with everything
↓
Team reviews and tweaks
↓
Guest gets personalized welcome
Step 1: Parse the issue
Guests submit through a GitHub issue form. The workflow extracts their info with regex:
const nameMatch = body.match(/### Name\s*\n\s*([^\n]+)/i);
const handleMatch = body.match(/### GitHub Handle\s*\n\s*@?([^\n\s]+)/i);
const projectMatch = body.match(/### Project Name\s*\n\s*([^\n]+)/i);
Nothing fancy here. Issue forms follow a consistent format, so regex gets us what we need. Copilot helped me write the regex, one less thing to debug.)
Step 2: Call the Copilot SDK
Under the hood, the SDK starts the Copilot CLI in server mode and talks to it over JSON‑RPC. You install the CLI once, then add the SDK to your project, and the SDK manages the CLI process lifecycle for you.
- name: Install dependencies
run: |
npm install -g @github/copilot
npm install @github/copilot-sdk puppeteer
Here’s how they work together:
Your code (@github/copilot-sdk)
↓
Copilot CLI (handles auth, spawns server)
↓
GitHub Copilot API (the actual AI)
The SDK spawns the CLI, which authenticates using your GH_TOKEN and proxies requests to Copilot. Then it’s just a few lines of code:
const { CopilotClient } = await import('@github/copilot-sdk');
const client = new CopilotClient();
await client.start();
const session = await client.createSession();
const response = await session.sendAndWait({ prompt: prompt });
if (response && response.data && response.data.content) {
personalizedMessage = response.data.content;
}
await session.destroy();
await client.stop();
The SDK handles sessions and cleanup. I pass the prompt and get back a draft message.
Step 3: Generate thumbnail
Using Puppeteer, the workflow opens our thumbnail generator, fills in the guest’s info, and captures the result:
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
await page.goto('https://andreagriffiths11.github.io/thumbnail-gen/');
await page.type('#guestName', guestName);
await page.type('#username', handle);
await page.click('#generateBtn');
Puppeteer is basically browser automation. It opens a headless browser (no GUI), navigates to our thumbnail generator, fills in the form fields, and extracts the canvas data. This beats manually making 50+ thumbnails a year.
Step 4: Post the comment
Everything gets assembled into a scaffolded comment with the AI-generated welcome message, thumbnail download link, prep checklist, and guest guide. We review it, make any tweaks, and the guest gets a welcome that shows we actually read their submission.
Kicking it off
One command triggers everything:
gh issue edit 195 --repo githubevents/open-source-friday --add-label "scheduled"
Or just click the label in the GitHub UI. Either way, we get a scaffolded welcome comment within minutes that we can review and send.
Lessons learned
Separate your steps. Parsing, AI generation, and thumbnail creation are separate workflow steps. One failure doesn’t break everything.
Prompt engineering is real work. Getting the tone right took iteration. The breakthrough was telling Copilot to match the guest’s energy, not just acknowledge their project.
Test with workflow_dispatch. Adding a manual trigger made debugging way easier than waiting for label events:
on:
issues:
types: [labeled]
workflow_dispatch:
inputs:
issue_number:
description: 'Issue number to test with'
required: true
type: number
You can test without spamming your actual issues.
AI is a starting point, not the finish line. The automation gives us a draft that’s already personalized to the guest’s submission. We still review every message before it goes out, but now we’re refining instead of writing from scratch.
What’s next
- Auto-generated social media copy drafts for promoting episodes
- Calendar invite automation
Try it yourself
The Copilot SDK opens up possibilities for automation that gives you a head start on tasks that need a human touch. If you have repetitive communication tasks (onboarding, responses, summaries) where you want to be personal but don’t always have time to start from scratch, this pattern might help.
The key isn’t replacing human attention. It’s giving yourself a better starting point. You’ll review everything. You’ll still add personality. But instead of staring at a canned message, you’re starting from something already grounded in who they are. That distinction matters. The automation reads the submission, pulls out the interesting bits, and gives you a draft. You make it yours.
The code lives in githubevents/open-source-friday if you want to see the full workflow.
About the Author: Andrea Griffiths is a Senior Developer Advocate at GitHub, where she helps engineering teams adopt and scale developer technologies. She’s passionate about making technical concepts accessible—to both humans and AI agents. Connect with her on LinkedIn, GitHub, or Twitter/X.
About the Author: Andrea Griffiths is a Senior Developer Advocate at GitHub, where she helps engineering teams adopt and scale developer technologies. She's passionate about making technical concepts accessible—to both humans and AI agents. Connect with her on LinkedIn, GitHub, or Twitter/X. · Read in Spanish