From 95684c14ad9a5849d77bd41abdba0198faa951dd Mon Sep 17 00:00:00 2001 From: scarf Date: Fri, 1 Sep 2023 21:11:17 +0900 Subject: [PATCH] ci: use autofix.ci --- .github/workflows/format.yml | 36 ++++++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 29 ----------------------------- 2 files changed, 36 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/format.yml delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 000000000000..89e924182085 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,36 @@ +name: automated format + +on: + pull_request_target: + paths: ["**.json", "**.cpp", "**.hpp", "**.h", "**.c"] + +jobs: + format: + runs-on: ubuntu-22.04 + permissions: + contents: write + + steps: + - uses: actions/checkout@v3 + with: + # Checkout the fork/head-repository and push changes to the fork. + # If you skip this, the base repository will be checked out and changes + # will be committed to the base repository! + repository: ${{ github.event.pull_request.head.repo.full_name }} + + # Checkout the branch made in the fork. Will automatically push changes + # back to this branch. + ref: ${{ github.head_ref }} + + - name: astyle + run: | + sudo apt-get install astyle + make astyle + + - name: json formatting + run: make style-all-json-parallel RELEASE=1 + + - uses: stefanzweifel/git-auto-commit-action@v4 + if: ${{ always() }} + with: + commit_message: "style(autofix.ci): format code" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 95cdfb373bcb..000000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Code Style Check - -on: - pull_request_target: - paths: ["**.json", "**.cpp", "**.hpp", "**.h", "**.c"] - pull_request: - paths: ["**.json", "**.cpp", "**.hpp", "**.h", "**.c"] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }}-${{ github.event_name }} - cancel-in-progress: true - -jobs: - lint: - if: ${{ github.event_name == 'pull_request_target' }} - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - run: sudo apt-get install astyle - - run: make astyle - - run: make style-all-json-parallel RELEASE=1 - - - uses: reviewdog/action-suggester@v1 - if: ${{ always() }} - with: - tool_name: astyle, style-json