docs: add workflow that deletes preview links on merge #1
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: cleanup-preview | |
| on: | |
| pull_request: | |
| types: [closed] | |
| jobs: | |
| cleanup: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Fern CLI | |
| uses: fern-api/setup-fern-cli@v1 | |
| - name: Delete preview deployment | |
| env: | |
| FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | |
| run: | | |
| echo "Deleting preview for branch: ${{ github.head_ref }}" | |
| fern docs preview delete --id "${{ github.head_ref }}" || echo "Preview deletion returned non-zero — it may already be gone" |