diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml new file mode 100644 index 000000000..01078d713 --- /dev/null +++ b/.github/workflows/fmt.yml @@ -0,0 +1,32 @@ +name: Automatically format the code when requested + +on: issue_comment + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + deno: ["v1.x"] + steps: + - uses: actions/checkout@v2 + - run: git submodule update --init --recursive + - uses: denoland/setup-deno@main + with: + deno-version: ${{ matrix.deno }} + - name: Cache dependencies + run: deno cache mod.ts + - name: Cache Templates + run: deno cache template/beginner/mod.ts template/bigbot/src/bot/mod.ts template/bigbot/src/gateway/mod.ts template/bigbot/src/rest/mod.ts template/minimal/mod.ts + - name: Format code + if: ${{ github.event.issue.pull_request && github.event.comment.body == 'run-fmt' && (github.actor == 'Skillz4Killz' || github.actor == 'itohatweb') }} + run: deno fmt + - name: Push changes + if: ${{ github.event.issue.pull_request && github.event.comment.body == 'run-fmt' && (github.actor == 'Skillz4Killz' || github.actor == 'itohatweb') }} + continue-on-error: true # if code is unchanged it will error + run: | + git config user.name Github Actions + git config user.email github-actions@github.com + git add . + git commit -m "chore: Format code" + git push