✨ Autofix: correções automáticas de código #253
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: Autofix Bot | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' # todo dia às 6h UTC | |
| workflow_dispatch: | |
| pull_request: | |
| types: [opened, synchronize] | |
| jobs: | |
| autofix: | |
| name: Run autofix and create PR | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # necessário para PRs | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Install autofix CLI | |
| run: npm install -g autofix-dev/autofix | |
| - name: Run autofix | |
| run: autofix --write | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "autofix-bot" | |
| git config --global user.email "autofix@users.noreply.github.com" | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet; then | |
| echo "no_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "no_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| if: steps.changes.outputs.no_changes == 'false' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.PERSONAL_TOKEN }} | |
| commit-message: "✨ autofix: correções automáticas de código" | |
| branch: "autofix/patch-${{ github.run_id }}" | |
| title: "✨ Autofix: correções automáticas de código" | |
| body: | | |
| Este Pull Request foi criado automaticamente pelo [autofix](https://github.com/autofix-dev/autofix). | |
| Corrige problemas detectados nas pastas configuradas. | |
| _Merge apenas se os testes estiverem passando._ |