|
| 1 | +name: Weekly Blog Post |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Every Monday at 09:00 UTC |
| 6 | + - cron: "0 9 * * 1" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + write-blog-post: |
| 11 | + name: Write Blog Post |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + pull-requests: write |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Install Claude Code |
| 22 | + run: npm install -g @anthropic-ai/claude-code |
| 23 | + |
| 24 | + - name: Generate blog post |
| 25 | + env: |
| 26 | + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
| 27 | + run: | |
| 28 | + claude --dangerously-skip-permissions -p " |
| 29 | + You are writing a blog post for the pgconsole website. Follow the write-blog-post skill in .claude/skills/write-blog-post/skill.md exactly, with one exception: since this is running in CI with no human to confirm topic selection, you must autonomously pick the best topic. |
| 30 | +
|
| 31 | + Steps: |
| 32 | + 1. Browse https://commitfest.postgresql.org/commitfest_history/ and https://pgpedia.info/postgresql-versions/ to find committed patches for the latest PostgreSQL version. |
| 33 | + 2. Check existing posts in website/content/blog/ to avoid duplicate topics. |
| 34 | + 3. Pick the single best topic — high impact, clear pain point, demonstrable with SQL examples. |
| 35 | + 4. Research the commit(s), pgsql-hackers mailing list threads, and real-world context. |
| 36 | + 5. Write the post to website/content/blog/{slug}.md following the structure, frontmatter, and writing style in the skill file. |
| 37 | + 6. Use today's date in the frontmatter. |
| 38 | +
|
| 39 | + Do NOT skip research. Every claim must be backed by a real commit hash and real mailing list link. Do NOT fabricate URLs. |
| 40 | + " |
| 41 | +
|
| 42 | + - name: Check for new post |
| 43 | + id: check |
| 44 | + run: | |
| 45 | + if git diff --quiet; then |
| 46 | + echo "has_changes=false" >> "$GITHUB_OUTPUT" |
| 47 | + else |
| 48 | + echo "has_changes=true" >> "$GITHUB_OUTPUT" |
| 49 | + fi |
| 50 | +
|
| 51 | + - name: Create Pull Request |
| 52 | + if: steps.check.outputs.has_changes == 'true' |
| 53 | + env: |
| 54 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + run: | |
| 56 | + BRANCH="blog/weekly-$(date +%Y-%m-%d)" |
| 57 | + git checkout -b "$BRANCH" |
| 58 | + git add website/content/blog/ |
| 59 | + git config user.name "github-actions[bot]" |
| 60 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 61 | + git commit -m "blog: add weekly blog post |
| 62 | +
|
| 63 | + Co-Authored-By: Claude <noreply@anthropic.com>" |
| 64 | + git push -u origin "$BRANCH" |
| 65 | + gh pr create \ |
| 66 | + --title "Blog: weekly post $(date +%Y-%m-%d)" \ |
| 67 | + --body "$(cat <<'EOF' |
| 68 | + ## Summary |
| 69 | +
|
| 70 | + Weekly auto-generated blog post about a recent PostgreSQL feature. |
| 71 | +
|
| 72 | + **Please review for:** |
| 73 | + - Factual accuracy (commit hashes, mailing list links) |
| 74 | + - Writing quality and tone |
| 75 | + - Technical correctness of SQL examples |
| 76 | +
|
| 77 | + 🤖 Generated with [Claude Code](https://claude.com/claude-code) |
| 78 | + EOF |
| 79 | + )" |
0 commit comments