Update follow return types and error handling #1217
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: Prettify | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.base.ref == 'trunk' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 'lts/*' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run formatter | |
| run: npm run format | |
| - name: Check for changes and commit | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then | |
| echo "::error::Formatting changes detected in PR from fork. Please run 'npm run format' locally and push the changes." | |
| exit 1 | |
| else | |
| echo "Formatting changes detected, committing files..." | |
| git config user.name "Automattic Bot" | |
| git config user.email "[email protected]" | |
| git add . | |
| git commit -m "Prettify" | |
| git push | |
| fi | |
| else | |
| echo "No formatting changes needed" | |
| fi |