Update google-java-format #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: Update google-java-format | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 6 1 * *" | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| update: | |
| name: Check for upstream formatter update | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 | |
| with: | |
| node-version: 24 | |
| - name: Configure JDK | |
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 | |
| with: | |
| distribution: "temurin" | |
| java-version: "25" | |
| - uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 | |
| name: Yarn Cache Restore | |
| id: yarn-cache | |
| with: | |
| path: .yarn/cache | |
| key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }} | |
| restore-keys: ${{ runner.os }}-yarn-v1 | |
| - name: Yarn Install | |
| uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 | |
| with: | |
| timeout_minutes: 15 | |
| retry_wait_seconds: 30 | |
| max_attempts: 3 | |
| command: yarn | |
| - name: Update formatter files | |
| id: update | |
| run: node ./scripts/update-google-java-format.js | |
| - name: Run tests | |
| if: steps.update.outputs.updated == 'true' | |
| run: ./test.sh | |
| - uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 | |
| name: Yarn Cache Save | |
| if: ${{ steps.update.outputs.updated == 'true' && github.ref == 'refs/heads/main' }} | |
| with: | |
| path: .yarn/cache | |
| key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }} | |
| - name: Create pull request | |
| if: steps.update.outputs.updated == 'true' | |
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | |
| with: | |
| token: ${{ github.token }} | |
| commit-message: "feat: adopt upstream google-java-format [${{ steps.update.outputs.latest_version }}]" | |
| branch: ci/google-java-format-update-${{ steps.update.outputs.latest_version }} | |
| delete-branch: true | |
| title: "feat: adopt upstream google-java-format [${{ steps.update.outputs.latest_version }}]" | |
| body: | | |
| Updates bundled google-java-format from `${{ steps.update.outputs.current_version }}` to `${{ steps.update.outputs.latest_version }}`. | |
| - Replaces the jar in `lib/` | |
| - Updates the hardcoded jar path in `index.js` | |
| - Runs `./test.sh` |