Fix/Docs-Page-Mobile-Friendly #1887
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 Code | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| prettier: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch base branch | |
| if: github.event_name == 'pull_request' | |
| run: git fetch origin ${{ github.event.pull_request.base.ref }} | |
| - name: Get changed files | |
| id: changed-files | |
| run: | | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| BASE_SHA="origin/${{ github.event.pull_request.base.ref }}" | |
| else | |
| BASE_SHA="${{ github.event.before }}" | |
| fi | |
| # Get files and store as space-separated string | |
| CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR -z $BASE_SHA HEAD | \ | |
| grep -zE '\.(js|md)$' | \ | |
| xargs -0 -r) | |
| if [ -n "$CHANGED_FILES" ]; then | |
| echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT | |
| echo "has_files=true" >> $GITHUB_OUTPUT | |
| echo "Changed files: $CHANGED_FILES" | |
| else | |
| echo "has_files=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Check code formatting | |
| if: steps.changed-files.outputs.has_files == 'true' | |
| uses: creyD/[email protected] | |
| with: | |
| prettier_version: 2.8.8 | |
| prettier_options: --check ${{ steps.changed-files.outputs.files }} | |
| dry: true |