A free, automated solution to monitor MentalMars for new Borderlands 4 SHiFT codes and receive email notifications when new codes are available.
- ✅ Free hosting using GitHub Actions
- ✅ Daily automated checks (runs at 9:00 AM UTC by default)
- ✅ Email notifications when new codes are found
- ✅ Multiple email providers supported (SendGrid, Resend, SMTP)
- ✅ No server required - completely serverless
- The scraper runs daily via GitHub Actions
- It fetches the MentalMars page and extracts all shift codes
- Compares with previously seen codes stored in
known_codes.json - Sends an email notification if new codes are found
- Updates the state file to track seen codes
git clone https://github.com/yourusername/borderlands-keys.git
cd borderlands-keysMailjet offers a free tier with 6,000 emails per month (200 per day), perfect for this project!
- Sign up at Mailjet
- Go to Account Settings → API Keys
- Copy your API Key and Secret Key
- Verify your sender email address:
- Go to Senders & Domains
- Add and verify your email address (check your inbox for verification email)
Go to your repository → Settings → Secrets and variables → Actions, and add:
Required:
RECIPIENT_EMAIL: Your email address to receive notificationsMAILJET_API_KEY: Your Mailjet API KeyMAILJET_API_SECRET: Your Mailjet Secret KeyMAILJET_FROM_EMAIL: Your verified sender email addressMAILJET_FROM_NAME: (Optional) Sender name, defaults to "Borderlands Monitor"
# Install dependencies
pip install -r requirements.txt
# Option 1: Use .env file (recommended)
cp .env.example .env
# Edit .env file with your actual credentials
python scraper.py
# Option 2: Set environment variables manually
export RECIPIENT_EMAIL="your-email@example.com"
export MAILJET_API_KEY="your-mailjet-api-key"
export MAILJET_API_SECRET="your-mailjet-api-secret"
export MAILJET_FROM_EMAIL="your-verified-email@example.com"
python scraper.pyUsing .env file:
- Copy
.env.exampleto.env:cp .env.example .env - Edit
.envand fill in your actual credentials - Run
python scraper.py- it will automatically load variables from.env - The
.envfile is gitignored, so your secrets stay local
- Push your code to GitHub
- Go to Actions tab in your repository
- The workflow will run automatically on the schedule (daily at 9:00 AM UTC)
- You can also trigger it manually via "Run workflow"
Edit .github/workflows/daily-check.yml to change the schedule:
schedule:
- cron: '0 9 * * *' # 9:00 AM UTC dailyCron format: minute hour day month weekday
0 9 * * *= 9:00 AM UTC daily0 14 * * *= 2:00 PM UTC daily (9:00 AM EST)0 0 * * *= Midnight UTC daily
borderlands-keys/
├── .github/
│ └── workflows/
│ └── daily-check.yml # GitHub Actions workflow
├── scraper.py # Main scraper script
├── requirements.txt # Python dependencies
├── known_codes.json # State file (auto-generated)
├── .gitignore
└── README.md
The scraper:
- Extracts all codes from the "Every Borderlands 4 SHiFT Code for Golden Keys" table
- Compares each code with previously seen codes in
known_codes.json - Only sends notifications for codes that haven't been seen before
- Updates the state file after each run
- Check GitHub Actions logs: Repository → Actions → Latest run
- Verify your secrets are set correctly
- Check your spam folder
- For SendGrid: Verify your sender email is verified
- For Gmail SMTP: Make sure you're using an App Password, not your regular password
- The website structure may have changed - check the HTML structure
- View the Actions logs to see error messages
- Test locally with
python scraper.py
- Make sure Actions are enabled: Repository → Settings → Actions
- Check the workflow file syntax
- Verify the schedule is correct (GitHub Actions may have delays)
- GitHub Actions: Free for public repositories (2,000 minutes/month)
- Mailjet: Free tier (6,000 emails/month, 200/day)
Total Cost: $0/month 🎉
MIT License - feel free to use and modify as needed!
Found a bug or want to improve something? Feel free to open an issue or submit a pull request!
- MentalMars for maintaining the shift codes page
- GitHub Actions for free CI/CD
- Mailjet for free email services