Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions .github/workflows/sync-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ on:
push:
branches: [main]
paths:
- 'skills/**'
- '.claude-plugin/**'
- '.claude-plugin/plugin.json'

jobs:
sync:
Expand All @@ -14,16 +13,34 @@ jobs:
- name: Checkout CLI repo
uses: actions/checkout@v4
with:
fetch-depth: 2
path: cli

- name: Check if version changed
id: version
run: |
cd cli
OLD=$(git show HEAD~1:.claude-plugin/plugin.json 2>/dev/null | jq -r '.version' 2>/dev/null || echo "")
NEW=$(jq -r '.version' .claude-plugin/plugin.json)
if [ "$OLD" = "$NEW" ]; then
echo "Version unchanged ($NEW), skipping sync"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Version changed: $OLD → $NEW"
echo "changed=true" >> $GITHUB_OUTPUT
echo "version=$NEW" >> $GITHUB_OUTPUT
fi

- name: Checkout Plugin repo
if: steps.version.outputs.changed == 'true'
uses: actions/checkout@v4
with:
repository: firecrawl/firecrawl-claude-plugin
token: ${{ secrets.PLUGIN_REPO_PAT }}
path: plugin

- name: Copy files
if: steps.version.outputs.changed == 'true'
run: |
# Sync skill files
rm -rf plugin/skills/firecrawl-cli
Expand All @@ -33,20 +50,12 @@ jobs:
cp cli/.claude-plugin/plugin.json plugin/.claude-plugin/plugin.json
cp cli/.claude-plugin/marketplace.json plugin/.claude-plugin/marketplace.json

- name: Bump version
run: |
cd plugin
VERSION=$(jq -r '.version' .claude-plugin/plugin.json)
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
jq --arg v "$NEW_VERSION" '.version = $v' .claude-plugin/plugin.json > tmp.json
mv tmp.json .claude-plugin/plugin.json
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV

- name: Create PR
if: steps.version.outputs.changed == 'true'
run: |
cd plugin
BRANCH="sync/cli-v${{ env.NEW_VERSION }}"
VERSION="${{ steps.version.outputs.version }}"
BRANCH="sync/cli-v${VERSION}"
git checkout -b "$BRANCH"
git add -A
if git diff --cached --quiet; then
Expand All @@ -55,12 +64,12 @@ jobs:
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Sync from firecrawl/cli — v${{ env.NEW_VERSION }}"
git commit -m "Sync from firecrawl/cli — v${VERSION}"
git push origin "$BRANCH"
gh pr create \
--repo firecrawl/firecrawl-claude-plugin \
--title "Sync CLI changes → v${{ env.NEW_VERSION }}" \
--body "Automated sync from [firecrawl/cli](https://github.com/firecrawl/cli) main branch." \
--title "Sync CLI changes → v${VERSION}" \
--body "Automated sync from [firecrawl/cli](https://github.com/firecrawl/cli) main branch (v${VERSION})." \
--base main \
--head "$BRANCH"
env:
Expand Down