Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(elixir-sdk): use PR instead of direct push for spec regeneration

firecrawl-spring[bot]20c23b11566e
diff --git a/.github/workflows/publish-elixir-sdk.yml b/.github/workflows/publish-elixir-sdk.yml
index 37f53ba53..2b01f75e3 100644
--- a/.github/workflows/publish-elixir-sdk.yml
+++ b/.github/workflows/publish-elixir-sdk.yml
@@ -16,7 +16,8 @@ defaults:
working-directory: ./apps/elixir-sdk
jobs:
- regenerate-and-publish:
+ regenerate:
+ if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
@@ -44,16 +45,59 @@ jobs:
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- - name: Commit regenerated code
- if: steps.check_changes.outputs.changed == 'true' && github.event_name == 'schedule'
+ - name: Create PR with regenerated code
+ if: steps.check_changes.outputs.changed == 'true'
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
+ cd "$GITHUB_WORKSPACE"
+
+ VERSION=$(grep '@version' apps/elixir-sdk/mix.exs | head -1 | sed 's/.*"\(.*\)".*/\1/')
+ BRANCH="chore/elixir-sdk-regen-v${VERSION}"
+
+ # Check if a PR already exists for this version
+ EXISTING_PR=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number' 2>/dev/null || true)
+ if [ -n "$EXISTING_PR" ]; then
+ echo "PR #${EXISTING_PR} already exists for ${BRANCH} — skipping."
+ exit 0
+ fi
+
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- cd "$GITHUB_WORKSPACE"
+
+ git checkout -b "$BRANCH"
git add apps/elixir-sdk/
- VERSION=$(grep '@version' apps/elixir-sdk/mix.exs | head -1 | sed 's/.*"\(.*\)".*/\1/')
git commit -m "chore(elixir-sdk): regenerate from OpenAPI spec (v${VERSION})"
- git push
+ git push -u origin "$BRANCH"
+
+ gh pr create \
+ --title "chore(elixir-sdk): regenerate from OpenAPI spec (v${VERSION})" \
+ --body "Auto-generated PR to update the Elixir SDK from the latest OpenAPI spec.
+
+ ## Changes
+ - Regenerated \`lib/firecrawl.ex\` from the v2 OpenAPI spec
+ - Version bumped to \`${VERSION}\`
+
+ This PR was created automatically by the \`publish-elixir-sdk\` workflow." \
+ --head "$BRANCH" \
+ --base main
+
+ publish:
+ if: github.event_name == 'push'
+ runs-on: blacksmith-2vcpu-ubuntu-2404
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v5
+
+ - name: Set up Elixir
+ uses: erlef/setup-beam@ee09b1e59bb240681c382eb1f0abc6a04af72764 # v1
+ with:
+ elixir-version: '1.17'
+ otp-version: '27'
+
+ - name: Install dependencies
+ run: mix deps.get
- name: Check if version needs publishing
id: version_info