From 2501d6682f3d461d351977f88377649b171f7cef Mon Sep 17 00:00:00 2001 From: Yasushi SHOJI Date: Sun, 25 Feb 2024 20:43:00 +0900 Subject: [PATCH] github: workflow: Add gitlint check gitlint is a tool to check git commit messages. This commit adds the check to all pull requests. Signed-off-by: Yasushi SHOJI --- .github/workflows/gitlint.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/gitlint.yaml diff --git a/.github/workflows/gitlint.yaml b/.github/workflows/gitlint.yaml new file mode 100644 index 0000000..c4c47cf --- /dev/null +++ b/.github/workflows/gitlint.yaml @@ -0,0 +1,31 @@ +name: GitLint + +on: + pull_request + +jobs: + gitlint: + runs-on: ubuntu-latest + name: Run gitlint against all commits in a PR + steps: + + - name: Install python dependencies + run: | + pip3 install gitlint + + - name: Checkout the code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Setup Git (pull request) + run: | + git checkout -b this_pr + + - name: Run gitlint + if: ${{ github.base_ref }} + env: + BASE_REF: ${{ github.base_ref }} + run: | + gitlint --commits origin/${BASE_REF}..this_pr