Enable automatic PR merge and Netlify deployment

Changes:
- Add auto-merge functionality to workflow after successful build
- Add automatic Netlify production deployment step
- Capture PR number from create-pull-request action
- Wait for merge to complete before deploying
- Add NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID secrets

Why:
- Eliminates manual PR review and merge step
- Automatically deploys new articles to production
- Complete end-to-end automation from detection to live site
- No human intervention required for routine article additions

Result:
- Workflow now runs fully automatically every 24 hours
- New articles detected → validated → merged → deployed
- Live site updates without manual intervention

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
kbanc85 2025-11-10 14:48:11 -05:00
parent 9ce978f3c7
commit fc46b49b35
1 changed files with 32 additions and 15 deletions

View File

@ -66,6 +66,7 @@ jobs:
- name: Create Pull Request - name: Create Pull Request
if: steps.check_changes.outputs.has_changes == 'true' && steps.build.outputs.build_status == 'success' if: steps.check_changes.outputs.has_changes == 'true' && steps.build.outputs.build_status == 'success'
id: create_pr
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@ -76,35 +77,51 @@ jobs:
body: | body: |
## 🆕 New Article(s) Detected ## 🆕 New Article(s) Detected
This PR was automatically created by the article monitoring workflow. This PR was automatically created and will be merged automatically.
### What Changed ### What Changed
- ✅ New article(s) added to `src/data/claims.ts` - ✅ New article(s) added to `src/data/claims.ts`
- ✅ Build completed successfully - ✅ Build completed successfully
- ✅ Auto-merge enabled
### Review Checklist ### Validation
- [ ] Review extracted claims for accuracy - ✅ All claims validated (0 errors)
- [ ] Check claim titles are concise and clear - ✅ Build successful
- [ ] Verify topics are appropriate - ✅ Ready for automatic deployment
- [ ] Confirm statistics have proper context
- [ ] Review supporting context paragraph
### Next Steps
1. Review the changes in `src/data/claims.ts`
2. If everything looks good, merge this PR
3. Deploy: `netlify deploy --dir=out --prod`
--- ---
🤖 Generated by GitHub Actions 🤖 Generated and auto-merged by GitHub Actions
labels: | labels: |
automated automated
content content
- name: Auto-merge PR
if: steps.check_changes.outputs.has_changes == 'true' && steps.create_pr.outputs.pull-request-number != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "🔄 Auto-merging PR #${{ steps.create_pr.outputs.pull-request-number }}"
gh pr merge ${{ steps.create_pr.outputs.pull-request-number }} --squash --delete-branch --auto
- name: Wait for merge
if: steps.check_changes.outputs.has_changes == 'true' && steps.create_pr.outputs.pull-request-number != ''
run: sleep 10
- name: Deploy to Netlify
if: steps.check_changes.outputs.has_changes == 'true' && steps.create_pr.outputs.pull-request-number != ''
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
echo "🚀 Deploying to Netlify..."
npm install -g netlify-cli
netlify deploy --dir=out --prod --message "Auto-deploy: New articles added"
- name: Summary - name: Summary
if: steps.check_changes.outputs.has_changes == 'true' if: steps.check_changes.outputs.has_changes == 'true'
run: | run: |
echo "✅ New article(s) processed and PR created!" echo "✅ New article(s) processed, merged, and deployed!"
echo "📝 Review the PR and merge when ready" echo "🌐 Live at: https://kbanc.com"
- name: No changes summary - name: No changes summary
if: steps.check_changes.outputs.has_changes == 'false' if: steps.check_changes.outputs.has_changes == 'false'