Merge pull request #92 from firecrawl/firecrawl-build-skills #17
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 Firecrawl Skill to Cursor Plugin | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'skills/firecrawl-cli/**' | |
| 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-cursor-plugin.git target 2>/dev/null || { | |
| mkdir target && cd target && git init | |
| git remote add origin https://x-access-token:${TOKEN}@github.com/firecrawl/firecrawl-cursor-plugin.git | |
| } | |
| - name: Sync firecrawl skill | |
| env: | |
| GH_TOKEN: ${{ secrets.FIRECRAWL_SKILLS_SYNC }} | |
| run: | | |
| cd target | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| rm -rf skills/firecrawl | |
| mkdir -p skills/firecrawl | |
| cp -R ../cli/skills/firecrawl-cli/. skills/firecrawl/ | |
| 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 firecrawl skill from firecrawl/cli (${SHORT_SHA})" | |
| git push origin main | |
| else | |
| BRANCH="sync/cursor-skill-${SHORT_SHA}" | |
| git checkout -b "$BRANCH" | |
| git commit -m "sync firecrawl skill from firecrawl/cli (${SHORT_SHA})" | |
| git push origin "$BRANCH" | |
| PR_URL=$(gh pr create \ | |
| --repo firecrawl/firecrawl-cursor-plugin \ | |
| --title "sync firecrawl skill (${SHORT_SHA})" \ | |
| --body "Automated sync of \`skills/firecrawl-cli\` from [firecrawl/cli@${SHORT_SHA}](${COMMIT_URL}) into \`skills/firecrawl\`." \ | |
| --base main \ | |
| --head "$BRANCH") | |
| echo "Created PR: $PR_URL" | |
| # Merge immediately. --auto requires branch protection with | |
| # required checks on the target repo, which firecrawl-cursor-plugin | |
| # doesn't have, and there's nothing to wait for on a sync PR anyway. | |
| gh pr merge --repo firecrawl/firecrawl-cursor-plugin --merge --delete-branch "$PR_URL" | |
| fi |