Skip to content

feat: blog implementation, components and migration #3

feat: blog implementation, components and migration

feat: blog implementation, components and migration #3

name: Sync Authors Data
on:
pull_request:
types: [opened, synchronize, reopened]
schedule:
- cron: '0 6 * * 1' # Weekly Monday 06:00 UTC
workflow_dispatch:
repository_dispatch:
types: [squad-json-updated]
permissions:
contents: write
pull-requests: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22.18.0'
cache: 'pnpm'
- name: Setup pnpm via corepack
run: |
corepack enable
corepack prepare pnpm@10.11.0 --activate
pnpm -v
- name: Install deps
run: pnpm install --frozen-lockfile
- name: Run authors sync (raw URLs)
id: sync
env:
TARGET_SITE: wonderland
USE_RAW_PFP_URLS: 'true'
run: pnpm --filter @handbook/scripts run script:infra:sync-authors
- name: Detect changes
id: git_status
run: |
echo "changed=$(git status --porcelain | wc -l | tr -d ' ')" >> $GITHUB_OUTPUT
- name: Commit changes
if: steps.git_status.outputs.changed != '0'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add sites/wonderland/blog/authors.yml sites/wonderland/static/img/pfp || true
git commit -m "chore(ci): sync authors from squad.json"
- name: Push changes to PR branch
if: steps.git_status.outputs.changed != '0' && github.event_name == 'pull_request'
run: |
git push
- name: Create branch and push (scheduled/dispatch)
if: steps.git_status.outputs.changed != '0' && github.event_name != 'pull_request'
env:
BRANCH_NAME: sync/authors-${{ github.run_id }}
run: |
git checkout -b "$BRANCH_NAME"
git push origin "$BRANCH_NAME"
- name: Create PR (scheduled/dispatch)
if: steps.git_status.outputs.changed != '0' && github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'chore(ci): sync authors from squad.json'
title: "chore: sync authors from squad.json"
body: |
Automated sync from `defi-wonderland/web` squad.json.
- Adds/updates authors in `sites/wonderland/blog/authors.yml`
- Downloads profile images to `sites/wonderland/static/img/pfp`
See job summary for details.
labels: 'automated, authors-sync'
branch: ${{ env.BRANCH_NAME }}
base: ${{ github.event.repository.default_branch || 'main' }}
- name: Comment summary on PR
if: github.event_name == 'pull_request'
run: |
if [ -f AUTHORS_SYNC_SUMMARY.md ]; then
gh pr comment ${{ github.event.pull_request.number }} --body-file AUTHORS_SYNC_SUMMARY.md
else
gh pr comment ${{ github.event.pull_request.number }} --body "Automated authors sync ran. See the job summary for details."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}