fix(ci): sync-frontend pushes directly to main instead of auto-merge PR (#27)

Auto-merge requires branch protection rules; without them PRs stall.
Since this workflow only modifies ui/static/ build artifacts, pushing
directly to main is safe and simpler.

Co-authored-by: Kelin <kelin@KelindeMacBook-Air.local>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
科林 KELIN
2026-03-17 15:14:28 +08:00
committed by GitHub
co-authored by Kelin Claude Sonnet 4.6
parent 4ba6a6089f
commit 6de89ada91
+10 -28
View File
@@ -5,7 +5,6 @@ on:
permissions:
contents: write
pull-requests: write
jobs:
sync:
@@ -13,6 +12,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Download latest frontend dist
run: |
@@ -29,41 +30,22 @@ jobs:
mkdir -p ui/static
tar -xzf frontend-dist.tar.gz -C ui/static
- name: Check for changes
id: diff
- name: Commit and push to main
run: |
git add ui/static/
if git diff --cached --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "Frontend is already up to date. Nothing to sync."
exit 0
fi
- name: Commit and open PR
if: steps.diff.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
FRONTEND_SHA=$(gh release view latest \
--repo HuangYuChuh/ComfyUI_Skills_OpenClaw-frontend \
--json body -q '.body' \
| grep -o '[0-9a-f]\{40\}' | head -1 || echo "latest")
--json tagName -q '.tagName' || echo "latest")
BRANCH="build/frontend-${FRONTEND_SHA:0:8}"
git checkout -b "$BRANCH"
git commit -m "build(ui): sync frontend assets from upstream@${FRONTEND_SHA:0:8}"
git push origin "$BRANCH"
PR_URL=$(gh pr create \
--title "build(ui): sync frontend assets from upstream@${FRONTEND_SHA:0:8}" \
--body "Auto-generated by \`sync-frontend\` workflow. Source: [ComfyUI_Skills_OpenClaw-frontend@${FRONTEND_SHA:0:8}](https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw-frontend/commit/${FRONTEND_SHA})" \
--base main)
gh pr merge "$PR_URL" --auto --squash
- name: No changes
if: steps.diff.outputs.changed == 'false'
run: echo "Frontend is already up to date. Nothing to sync."
git commit -m "build(ui): sync frontend assets from upstream@${FRONTEND_SHA}"
git push origin main
env:
GH_TOKEN: ${{ github.token }}