From e4eab564953c7ceb57fb652c52c08969725ccb56 Mon Sep 17 00:00:00 2001 From: Yutetsu TAKATSUKASA Date: Thu, 17 Dec 2020 23:41:10 +0900 Subject: [PATCH] Add a workflow that calls clang-format and commit. (#2713) * Add a workflow that calls clang-format and commit. --- .github/workflows/clang-format.yml | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/clang-format.yml diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml new file mode 100644 index 000000000..145501933 --- /dev/null +++ b/.github/workflows/clang-format.yml @@ -0,0 +1,44 @@ +# DESCRIPTION: Github actions config +# This name is key to badges in README.adoc, so we use the name build +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +name: clang-format + +on: + push: + pull_request_target: + workflow_dispatch: + +jobs: + format: + runs-on: ubuntu-20.04 + name: Ubuntu 20.04 | format + env: + CI_OS_NAME: linux + CI_RUNS_ON: ubuntu-20.04 + CI_COMMIT: ${{ github.sha }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Install packages for build + env: + CI_BUILD_STAGE_NAME: build + run: | + bash ci/ci-install.bash && + sudo apt-get install clang-10 && + git config --global user.email "action@example.com" && + git config --global user.name "github action" + - name: Format code + run: | + autoconf && + ./configure && + make clang-format CLANGFORMAT=clang-format-10 && + git status + - name: Push + run: | + if [ -n "$(git status --porcelain)" ]; then + git commit . -m "Apply clang-format" && + git push origin + fi