From 27f8fe66d5e5a73dbb9885781c59a13a8cde501f Mon Sep 17 00:00:00 2001 From: Emanuela Epure <67077116+emanuelaepure10@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:15:57 +0100 Subject: [PATCH] feat: update action conventional commits BREAKING CHANGE: `extends` key in config file is now used for extending other config files ING-3232 --- .../action-conventional-commits-taskmedia.yml | 30 +++++++++++++++++++ .../workflows/action-conventional-commits.yml | 3 +- .github/workflows/check-commit-message.yml | 17 +++++++++++ .github/workflows/commit-quality-checker.yml | 20 +++++++++++++ .github/workflows/commit_message.yml | 6 ++-- .github/workflows/commitlint.yml | 1 + .../workflows/gs-commit-message-checker.yml | 25 +++++----------- 7 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/action-conventional-commits-taskmedia.yml create mode 100644 .github/workflows/check-commit-message.yml create mode 100644 .github/workflows/commit-quality-checker.yml diff --git a/.github/workflows/action-conventional-commits-taskmedia.yml b/.github/workflows/action-conventional-commits-taskmedia.yml new file mode 100644 index 0000000..c387aa9 --- /dev/null +++ b/.github/workflows/action-conventional-commits-taskmedia.yml @@ -0,0 +1,30 @@ + # https://github.com/taskmedia/action-conventional-commits/tree/main +name: Action Conventional Commits Taskmedia + +on: + push: + branches: + - main + +jobs: + build: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: taskmedia/action-conventional-commits@v1.1.14 + with: + # token to access GitHub API to receive PR commits + # Default: ${{ github.token }} + token: ${{ secrets.GITHUB_TOKEN }} + + # skip merge commits + # Default: true + skip_merge: "" + + # skip revert commits + # Default: true + skip_revert: "" + + # allow different types in commit message + # Default: fix|feat|revert + types: "feat|fix|docs|style|refactor|perf|test|chore" \ No newline at end of file diff --git a/.github/workflows/action-conventional-commits.yml b/.github/workflows/action-conventional-commits.yml index cc3ab9b..5c87818 100644 --- a/.github/workflows/action-conventional-commits.yml +++ b/.github/workflows/action-conventional-commits.yml @@ -1,3 +1,4 @@ + # https://github.com/webiny/action-conventional-commits name: Action Conventional Commits on: @@ -15,4 +16,4 @@ jobs: - uses: webiny/action-conventional-commits@v1.3.0 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Optional, for private repositories. - allowed-commit-types: "feat,fix" # Optional, set if you want a subset of commit types to be allowed. \ No newline at end of file + allowed-commit-types: "feat,fix,docs,style,refactor,perf,test,chore" # Optional, set if you want a subset of commit types to be allowed. \ No newline at end of file diff --git a/.github/workflows/check-commit-message.yml b/.github/workflows/check-commit-message.yml new file mode 100644 index 0000000..fa85b93 --- /dev/null +++ b/.github/workflows/check-commit-message.yml @@ -0,0 +1,17 @@ + # https://github.com/marketplace/actions/check-commit-message +name: Check Commit Message + +on: + push: + branches: + - main + +jobs: + check: + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Check commit ๐Ÿงช + uses: adityaa30/check-commit@master \ No newline at end of file diff --git a/.github/workflows/commit-quality-checker.yml b/.github/workflows/commit-quality-checker.yml new file mode 100644 index 0000000..88021b2 --- /dev/null +++ b/.github/workflows/commit-quality-checker.yml @@ -0,0 +1,20 @@ + # https://github.com/marketplace/actions/commit-quality-checker +name: Beams Commit Message Checker + +on: + push: + branches: + - main + +jobs: + check-commit-message: + runs-on: ubuntu-latest + name: Check commit message + permissions: + pull-requests: write # required to post pull request comments + contents: read # required to read commit information + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Check commit message + uses: actions/beams-commit-message-checker@v0.1.0 \ No newline at end of file diff --git a/.github/workflows/commit_message.yml b/.github/workflows/commit_message.yml index 4b54779..25dfec2 100644 --- a/.github/workflows/commit_message.yml +++ b/.github/workflows/commit_message.yml @@ -1,4 +1,6 @@ -name: Check Commit Message + # custom commit checker + +name: Check Commit Message CUSTOM on: push: @@ -16,7 +18,7 @@ jobs: - name: Check commit message run: | COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.sha }}) - PATTERN_MSG='^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .{1,100}$' + PATTERN_MSG='^(fixup! )?(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .{1,100}$' if [[ ! $COMMIT_MSG =~ $PATTERN_MSG ]]; then echo "Invalid commit message format. Must match pattern: /^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .{1,100}$/" exit 1 diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 2f65892..9fb2407 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,3 +1,4 @@ + # name: Commitlint on: diff --git a/.github/workflows/gs-commit-message-checker.yml b/.github/workflows/gs-commit-message-checker.yml index 6924583..efabf7f 100644 --- a/.github/workflows/gs-commit-message-checker.yml +++ b/.github/workflows/gs-commit-message-checker.yml @@ -1,3 +1,4 @@ + # https://github.com/marketplace/actions/gs-commit-message-checker?version=v2.0.0 name: 'GS Commit Message Checker' on: pull_request: @@ -19,26 +20,16 @@ on: jobs: check-commit-message: - name: Check Commit Message + name: GS Commit Message Checker runs-on: ubuntu-latest steps: - - name: Check Commit Type - uses: gsactions/commit-message-checker@v1 - with: - pattern: '^.+(feat|fix|docs|style|refactor|perf|test|chore): .+$' - flags: 'gm' - error: 'Your first line has to contain a commit type like "feat: your_title".' - - name: Check Line Length + - name: Check for Resolves / Fixes uses: gsactions/commit-message-checker@v1 with: - pattern: '^[^#].{74}' - error: 'The maximum line length of 74 characters is exceeded.' - excludeDescription: 'true' # optional: this excludes the description body of a pull request - excludeTitle: 'true' # optional: this excludes the title of a pull request - checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request - accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true - - name: Check for Resolves / Fixes + pattern: '^.+(ING)\-[0-9]+$' + error: 'You need at least one "ING-" line.' + - name: Check Commit Type uses: gsactions/commit-message-checker@v1 with: - pattern: '^.+(feat|fix|docs|style|refactor|perf|test|chore): \#[0-9]+$' - error: 'You need at least one "feat|fix|docs|style|refactor|perf|test|chore: #" line.' \ No newline at end of file + pattern: '^.+(feat|fix|docs|style|refactor|perf|test|chore): .+$' + error: 'Your first line has to contain a commit type like "feat: your_title".' \ No newline at end of file