From d23cda43899c89e8cdb854c9e4730117f09637ed Mon Sep 17 00:00:00 2001 From: "Jose D. Gomez R" Date: Tue, 24 Oct 2023 14:09:46 +0200 Subject: [PATCH] Reusable Workflow Experiment: Upstreaming commit message checks - Bringing checks from os-autoinst/openQA#5343. - Setting up reusable workflows [0]. [0]: https://docs.github.com/en/actions/using-workflows/reusing-workflows Reusable Workflow Experiment: Upstreaming commit message checks - Bringing checks from os-autoinst/openQA#5343. - Setting up reusable workflows [0]. [0]: https://docs.github.com/en/actions/using-workflows/reusing-workflows --- ...er.yml => base-commit-message-checker.yml} | 40 ++++++++++--------- .github/workflows/commit-message-checker.yml | 15 +++++++ 2 files changed, 36 insertions(+), 19 deletions(-) rename .github/workflows/{commit_message_checker.yml => base-commit-message-checker.yml} (51%) create mode 100644 .github/workflows/commit-message-checker.yml diff --git a/.github/workflows/commit_message_checker.yml b/.github/workflows/base-commit-message-checker.yml similarity index 51% rename from .github/workflows/commit_message_checker.yml rename to .github/workflows/base-commit-message-checker.yml index 5e0c556..480b718 100644 --- a/.github/workflows/commit_message_checker.yml +++ b/.github/workflows/base-commit-message-checker.yml @@ -1,50 +1,52 @@ --- -# https://github.com/marketplace/actions/gs-commit-message-checker name: 'Commit message check' -# yamllint disable-line rule:truthy + on: - pull_request: - push: - branches: - - '!master' # we must not fix commit messages when they already reached master + workflow_call: + secrets: + accessToken: + required: true jobs: - check-commit-message: + base-check-commit-message: name: Check commit message runs-on: ubuntu-latest steps: - name: Check subject beginning - uses: gsactions/commit-message-checker@v1 + uses: gsactions/commit-message-checker@v2 with: - pattern: '^([A-Z]|[A-Za-z0-9_/.\-\s]+:|git subrepo pull)' + pattern: '^([A-Z]|\S+:|git subrepo pull)' flags: 'g' error: 'The subject does not start with a capital or tag.' excludeDescription: 'true' excludeTitle: 'true' checkAllCommitMessages: 'true' - accessToken: ${{ secrets.GITHUB_TOKEN }} + accessToken: ${{ secrets.accessToken }} + - name: Check subject line length - uses: gsactions/commit-message-checker@v1 + uses: gsactions/commit-message-checker@v2 with: pattern: '^.{1,72}(\n|$)' flags: 'g' error: 'The maximum subject line length of 72 characters is exceeded.' - excludeDescription: 'true' # excludes the description body of a pull request - excludeTitle: 'true' # excludes the title of a pull request - checkAllCommitMessages: 'true' # checks all commits associated with a pull request - accessToken: ${{ secrets.GITHUB_TOKEN }} # only required if checkAllCommitMessages is true + excludeDescription: 'true' + excludeTitle: 'true' + checkAllCommitMessages: 'true' + accessToken: ${{ secrets.accessToken }} + - name: Check subject ending uses: gsactions/commit-message-checker@v2 with: pattern: '^.+(?