Merge pull request #92 from firecrawl/firecrawl-build-skills #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync to Claude Plugin | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'skills/firecrawl-cli/**' | |
| - '.claude-plugin/**' | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout CLI repo | |
| uses: actions/checkout@v6 | |
| with: | |
| path: cli | |
| - name: Clone target repo | |
| env: | |
| TOKEN: ${{ secrets.FIRECRAWL_SKILLS_SYNC }} | |
| run: | | |
| git clone https://x-access-token:${TOKEN}@github.com/firecrawl/firecrawl-claude-plugin.git plugin 2>/dev/null || { | |
| mkdir plugin && cd plugin && git init | |
| git remote add origin https://x-access-token:${TOKEN}@github.com/firecrawl/firecrawl-claude-plugin.git | |
| } | |
| - name: Sync Claude plugin files | |
| env: | |
| GH_TOKEN: ${{ secrets.FIRECRAWL_SKILLS_SYNC }} | |
| run: | | |
| cd plugin | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| rm -rf skills/firecrawl-cli | |
| mkdir -p skills/firecrawl-cli | |
| cp -R ../cli/skills/firecrawl-cli/. skills/firecrawl-cli/ | |
| mkdir -p .claude-plugin | |
| cp ../cli/.claude-plugin/plugin.json .claude-plugin/plugin.json | |
| cp ../cli/.claude-plugin/marketplace.json .claude-plugin/marketplace.json | |
| git add -A | |
| if git diff --cached --quiet; then | |
| echo "No changes to sync" | |
| exit 0 | |
| fi | |
| SHORT_SHA="${GITHUB_SHA:0:7}" | |
| COMMIT_URL="https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" | |
| if ! git rev-parse HEAD >/dev/null 2>&1; then | |
| git checkout -b main | |
| git commit -m "sync Claude plugin from firecrawl/cli (${SHORT_SHA})" | |
| git push origin main | |
| else | |
| BRANCH="sync/claude-plugin-${SHORT_SHA}" | |
| git checkout -b "$BRANCH" | |
| git commit -m "sync Claude plugin from firecrawl/cli (${SHORT_SHA})" | |
| git push origin "$BRANCH" | |
| PR_URL=$(gh pr create \ | |
| --repo firecrawl/firecrawl-claude-plugin \ | |
| --title "sync Claude plugin (${SHORT_SHA})" \ | |
| --body "Automated sync of \`skills/firecrawl-cli\` and \`.claude-plugin\` from [firecrawl/cli@${SHORT_SHA}](${COMMIT_URL})." \ | |
| --base main \ | |
| --head "$BRANCH") | |
| echo "Created PR: $PR_URL" | |
| # Merge immediately. --auto requires branch protection with | |
| # required checks on the target repo, which firecrawl-claude-plugin | |
| # doesn't have, and there's nothing to wait for on a sync PR anyway. | |
| gh pr merge --repo firecrawl/firecrawl-claude-plugin --merge --delete-branch "$PR_URL" | |
| fi |