Skip to content

Adicionado o arquivo .prettierrc com a configuração do Prettier #106

Adicionado o arquivo .prettierrc com a configuração do Prettier

Adicionado o arquivo .prettierrc com a configuração do Prettier #106

Workflow file for this run

name: Prettier
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Install Prettier
run: npm install --save-dev --save-exact prettier @shopify/prettier-plugin-liquid
- name: Prettier check
id: prettier
run: npx prettier . --check
- name: Create diff
# https://docs.github.com/en/actions/learn-github-actions/expressions#failure
if: ${{ failure() }}
run: |
npx prettier . --write
git diff -- . ':(exclude)package-lock.json' ':(exclude)package.json' > diff.txt
npm install -g diff2html-cli
diff2html -i file -s side -F diff.html -- diff.txt
- name: Upload html diff
id: artifact-upload
if: ${{ failure() && steps.prettier.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: HTML Diff
path: diff.html
retention-days: 7
- name: Dispatch information to repository
if: ${{ failure() && steps.prettier.conclusion == 'failure' && github.event_name == 'pull_request' }}
uses: peter-evans/repository-dispatch@v2
with:
event-type: prettier-failed-on-pr
client-payload: '{"pr_number": "${{ github.event.number }}", "artifact_url": "${{ steps.artifact-upload.outputs.artifact-url }}", "run_id": "${{ github.run_id }}"}'