Update prettier.yml #8
This file contains 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 the code | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- review_requested | |
- review_request_removed | |
- closed | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Verificar aprovação dos revisores | |
run: | | |
if [ "${{ github.event_name }}" != "pull_request" ]; then | |
echo "Este não é um evento de pull request. Saindo..." | |
exit 0 | |
fi | |
if [ "${{ github.event.pull_request.state }}" != "open" ]; then | |
echo "Esta pull request não está aberta. Saindo..." | |
exit 0 | |
fi | |
if [ "${{ github.event.pull_request.reviews.nodes[0].state }}" != "APPROVED" ]; then | |
echo "Esta pull request não foi aprovada pelos revisores. Saindo..." | |
exit 0 | |
fi | |
echo "A pull request foi aprovada pelos revisores. Continuando com o fluxo de trabalho..." | |
- name: Setup Node.js | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Format prettier | |
run: npx prettier --write . | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
with: | |
commit_message: 'style: format files' |