Setting Up GitHub Secrets for Auto-Tweet
Once you have your 4 X (Twitter) API credentials from the previous guide, follow these steps to add them to GitHub.
Step 1: Go to Your Repository Settings
- Open your browser and go to: https://github.com/NightOwlCoder/NightOwlCoder.github.io
- Click the “Settings” tab (far right)
- In the left sidebar, click “Secrets and variables” → “Actions”
Step 2: Add Each Secret
You need to add 4 secrets. For each one:
- Click “New repository secret” button
- Enter the Name (exactly as shown below)
- Paste the corresponding Value from your X API credentials
- Click “Add secret”
Secret 1: TWITTER_API_KEY
- Name:
TWITTER_API_KEY - Value: Your API Key (also called Consumer Key)
Secret 2: TWITTER_API_SECRET
- Name:
TWITTER_API_SECRET - Value: Your API Key Secret (also called Consumer Secret)
Secret 3: TWITTER_ACCESS_TOKEN
- Name:
TWITTER_ACCESS_TOKEN - Value: Your Access Token
Secret 4: TWITTER_ACCESS_TOKEN_SECRET
- Name:
TWITTER_ACCESS_TOKEN_SECRET - Value: Your Access Token Secret
Step 3: Verify All Secrets Are Added
After adding all 4 secrets, you should see them listed:
- ✓ TWITTER_API_KEY
- ✓ TWITTER_API_SECRET
- ✓ TWITTER_ACCESS_TOKEN
- ✓ TWITTER_ACCESS_TOKEN_SECRET
Note: You won’t be able to see the secret values after saving them (for security), but that’s normal!
✅ You’re Done!
The automation is now set up. Here’s what happens next:
- You create a new blog post in
_posts/ - Add an
excerpt:field to your front matter (optional but recommended) - Commit and push to GitHub
- GitHub Actions automatically tweets your new post! 🎉
How to Add an Excerpt to Your Posts
When creating a blog post, add an excerpt: field to the front matter like this:
---
layout: post
title: "Your Post Title"
date: 2025-10-25 19:50:00 -0700
categories: category1 category2
excerpt: "A short 1-2 sentence summary that will appear in the tweet"
---
Without excerpt: Tweet will just have title + link
With excerpt: Tweet will have title + your custom summary + link
Testing the Automation
Want to test it? Here’s how:
- Create a simple test post in
_posts/ - Add an excerpt
- Commit and push
- Go to your repo → Actions tab
- Watch the workflow run
- Check your Twitter feed! (@OwlCoder)
If something goes wrong, check the Actions logs for error messages.