Sync cli-sdk into generators/cli/sdk #5
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 cli-sdk into generators/cli/sdk | |
| on: | |
| schedule: | |
| # Daily at 06:00 UTC (after US-Pacific EOD, before EU morning) | |
| - cron: "0 6 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: sync-cli-sdk | |
| cancel-in-progress: true | |
| env: | |
| DO_NOT_TRACK: "1" | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout fern | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| - name: Checkout cli-sdk at main HEAD | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: fern-api/cli-sdk | |
| ref: main | |
| path: _cli-sdk | |
| token: ${{ secrets.FERN_SUPPORT_GH_ACTIONS_PAT }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Run sync script | |
| run: bash generators/cli/scripts/sync-sdk.sh _cli-sdk | |
| - name: Verify projected SDK builds | |
| run: cargo build --locked --all-features | |
| working-directory: generators/cli/sdk | |
| - name: Check for changes | |
| id: diff | |
| run: | | |
| git add -A generators/cli/sdk/ | |
| if git diff --cached --quiet; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Read provenance | |
| if: steps.diff.outputs.changed == 'true' | |
| id: provenance | |
| run: | | |
| SHA="$(head -1 generators/cli/sdk/.synced-from | sed 's/cli-sdk@//')" | |
| SHORT="${SHA:0:7}" | |
| echo "sha=$SHA" >> "$GITHUB_OUTPUT" | |
| echo "short=$SHORT" >> "$GITHUB_OUTPUT" | |
| - name: Create pull request | |
| if: steps.diff.outputs.changed == 'true' | |
| id: cpr | |
| uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8 | |
| with: | |
| token: ${{ secrets.FERN_SUPPORT_GH_ACTIONS_PAT }} | |
| # Scope staging to the synced path only. Without this the action runs | |
| # `git add -A` across the whole tree and captures the transient | |
| # `_cli-sdk` clone as a submodule gitlink (mode 160000). | |
| add-paths: generators/cli/sdk/ | |
| commit-message: "chore(cli-generator): sync cli-sdk@${{ steps.provenance.outputs.short }}" | |
| title: "chore(cli-generator): sync cli-sdk@${{ steps.provenance.outputs.short }}" | |
| body: | | |
| Automated sync of [fern-api/cli-sdk](https://github.com/fern-api/cli-sdk) `main` HEAD into `generators/cli/sdk/`. | |
| **Source**: `cli-sdk@${{ steps.provenance.outputs.sha }}` | |
| Generated by `.github/workflows/sync-cli-sdk.yml` via `generators/cli/scripts/sync-sdk.sh`. | |
| Seed tests (`pnpm seed test --generator cli`) are the trust boundary — if they pass, a human reviewer can merge. | |
| branch: chore/sync-cli-sdk | |
| delete-branch: true | |
| labels: | | |
| cli-generator | |
| automated |