From 0822a16b2e1c11b60ff6a2d177357e758196c426 Mon Sep 17 00:00:00 2001 From: Renato Foot Date: Thu, 15 Aug 2024 02:31:10 +0000 Subject: [PATCH] add: lua format workflow --- .github/workflows/lua-format-workflow.yml | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/lua-format-workflow.yml diff --git a/.github/workflows/lua-format-workflow.yml b/.github/workflows/lua-format-workflow.yml new file mode 100644 index 00000000000..818d7fa5997 --- /dev/null +++ b/.github/workflows/lua-format-workflow.yml @@ -0,0 +1,40 @@ +--- + on: + workflow_run: + workflows: [Lua-format] + types: [completed] + + jobs: + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + + - name: Set up Git + if: ${{ github.ref != 'refs/heads/main' }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "GitHub Actions" + - name: Actions checkout + if: ${{ github.ref != 'refs/heads/main' }} + uses: actions/checkout@v3 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: JohnnyMorganz/stylua-action@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + args: . + + - name: Run add and commit + if: ${{ github.ref != 'refs/heads/main' }} + uses: EndBug/add-and-commit@v9 + with: + author_name: GitHub Actions + author_email: github-actions[bot]@users.noreply.github.com + message: "Lua code format - (Stylua)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}