correct point #3071
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: Format Code with Prettier | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| format: | |
| if: ${{ github.repository != 'RocketChat/Rocket.Chat.ReactNative' || (github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/single-server') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Checkout and Setup Node | |
| uses: ./.github/actions/setup-node | |
| - name: Run Prettier | |
| run: yarn prettier --write . | |
| - name: Run ESLint | |
| run: npx eslint . --fix | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet; then | |
| echo "No code format changes detected" | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Code format changes detected" | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push eslint changes | |
| if: steps.changes.outputs.changes == 'true' | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| git add . | |
| git commit -m "chore: format code and fix lint issues [skip ci]" | |
| git push origin ${{ github.ref_name }} |