This guide explains how to set up the automated resource submission feature that creates pull requests via the website.
- ✅ Submit form modal on the website
- ✅ Automated PR creation to GitHub
- ✅ Category selection
- ✅ Optional submitter credit (name, email, GitHub username)
- ✅ No manual GitHub access needed for users
-
Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
-
Click "Generate new token (classic)"
-
Name it:
Curated Design Resources - PR Bot -
Set expiration: No expiration (or choose a long duration)
-
Select scopes:
- ✅
repo(Full control of private repositories)- This includes:
repo:status,repo_deployment,public_repo,repo:invite,security_events
- This includes:
- ✅
-
Click "Generate token"
-
IMPORTANT: Copy the token immediately (you won't be able to see it again!)
-
Go to Netlify Dashboard
-
Select your mossaique site
-
Go to Site settings → Environment variables
-
Click "Add a variable"
-
Add:
- Key:
GITHUB_TOKEN - Value: Paste your GitHub token
- Scopes: Select "All scopes" or choose specific deploy contexts
- Key:
-
Click "Save"
Once you've added the environment variable:
- Push your code to GitHub
- Netlify will automatically deploy
- The submit form will now work!
User submits form
↓
Netlify Function receives data
↓
GitHub API:
1. Creates new branch
2. Updates README.md
3. Creates Pull Request
↓
You review & merge PR
↓
Parse script runs automatically
↓
Resource appears on website
To test the function locally (optional):
# Install Netlify CLI
npm install -g netlify-cli
# Run dev server with functions
netlify devSet environment variable for local testing:
# Create .env file
echo "GITHUB_TOKEN=your_token_here" > .envNote: Don't commit .env file to Git! It's already in .gitignore.
- Generate a new token and update it in Netlify environment variables
- Check Netlify Function logs: Site settings → Functions → Logs
- Verify token has
reposcope - Ensure token hasn't expired
- Check that category ID matches those in
categories.js - Verify README.md has proper category headers
- ✅ Token is stored securely in Netlify (not in code)
- ✅ Function only accepts POST requests
- ✅ Form validation prevents empty submissions
- ✅ All PRs require your manual review before merging
- ✅ Submitter information is optional
If you encounter issues, check:
- Netlify Function logs
- GitHub token permissions
- README.md format matches expected structure
Ready to go! Users can now submit resources directly from the website. 🎉