fix: degrade gracefully when git is unavailable or diff base ref is missing #2113
Workflow file for this run
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: Publish Any Commit | |
| on: [push, pull_request] | |
| permissions: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - uses: pnpm/action-setup@v5 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22.18.0 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile --prefer-offline | |
| - run: pnpm build | |
| - name: Publish packages (retry on transient failures) | |
| run: | | |
| max_attempts=4 | |
| attempt=1 | |
| while [ "$attempt" -le "$max_attempts" ]; do | |
| if pnpm dlx pkg-pr-new publish \ | |
| ./packages/react-doctor \ | |
| ./packages/oxlint-plugin-react-doctor \ | |
| ./packages/eslint-plugin-react-doctor; then | |
| exit 0 | |
| fi | |
| if [ "$attempt" -eq "$max_attempts" ]; then | |
| exit 1 | |
| fi | |
| sleep_seconds=$((2 ** attempt)) | |
| echo "pkg-pr-new publish failed on attempt ${attempt}/${max_attempts}; retrying in ${sleep_seconds}s..." | |
| sleep "$sleep_seconds" | |
| attempt=$((attempt + 1)) | |
| done |