From 45bba9a001281ca4f401f6e4c6ed279f9902fd41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 07:54:37 +0800 Subject: [PATCH 01/57] chore(deps): bump commit-check from 0.7.3 to 0.7.4 (#45) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5c0c2fb..98ea5e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.7.3 +commit-check==0.7.4 From 4b0359b69adc2162c8400c927748107e0cd61f19 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Wed, 17 Apr 2024 08:50:24 -0400 Subject: [PATCH 02/57] fix: update README.md to fix used-by action failure (#47) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b655631..1718ec7 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=13&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=13&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From fefad96ae2d5290d8807322f60edcb6a7bd81fee Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Wed, 17 Apr 2024 21:07:26 +0800 Subject: [PATCH 03/57] fix: update used-by.yml to add permissions --- .github/workflows/used-by.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/used-by.yml b/.github/workflows/used-by.yml index ea70dc8..2774628 100644 --- a/.github/workflows/used-by.yml +++ b/.github/workflows/used-by.yml @@ -6,6 +6,10 @@ on: - cron: '0 9 * * 1' # At 09:00 on Monday. workflow_dispatch: +permissions: + pull-requests: write + contents: write + jobs: used-by: runs-on: ubuntu-latest From 9386a211b5e9c561fcf019999b5a52f1dc945b72 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 21:12:18 +0800 Subject: [PATCH 04/57] chore: update used-by badge by github-actions[bot] (#48) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1718ec7..746f93b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=13&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=16&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From f97b659e0b13c1beba4878210dbc39708ba08999 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Wed, 17 Apr 2024 09:22:32 -0400 Subject: [PATCH 05/57] feat: call reuseble workflows release-drafter from .github repo (#49) * feat: call reuseble workflows release-drafter from .github repo * fix: update release-drafter.yml to correct repo name * fix: remove push event from commit-check.yml --- .github/workflows/commit-check.yml | 1 - .github/workflows/release-drafter.yml | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 9689bb3..967657d 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -1,7 +1,6 @@ name: Commit Check on: - push: pull_request: branches: 'main' workflow_dispatch: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index c6536f9..d25c13e 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -7,10 +7,5 @@ on: workflow_dispatch: jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - # Drafts your next Release notes as Pull Requests are merged into the default branch - - uses: release-drafter/release-drafter@v6 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + draft-release: + uses: commit-check/.github/.github/workflows/release-drafter.yml@main From 9959fd28d29ab0a1421c17f709845ff9109401e2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:16:59 +0800 Subject: [PATCH 06/57] chore: update used-by badge by github-actions[bot] (#50) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 746f93b..f771beb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=16&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=17&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From 8faff00da4b214609dd8e5d6a032e5635ed51b96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 15:20:02 +0800 Subject: [PATCH 07/57] chore(deps): bump commit-check from 0.7.4 to 0.8.0 (#51) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.7.4 to 0.8.0. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.7.4...v0.8.0) --- updated-dependencies: - dependency-name: commit-check dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 98ea5e9..80b0de5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.7.4 +commit-check==0.8.0 From 2ebbd35ca9bf653e715b0331a93149703ace2054 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:25:55 +0800 Subject: [PATCH 08/57] chore: update used-by badge by github-actions[bot] (#52) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f771beb..447af25 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=17&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=18&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From 6885b5f5f0b701d1814a2b7f7d6aa961157db4fe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 17:21:44 +0800 Subject: [PATCH 09/57] chore: update used-by badge by github-actions[bot] (#54) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 447af25..52243dd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=18&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=21&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From 9c5167211a7f3847abc3b5fac6048d672dd9fbe6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:58:09 +0300 Subject: [PATCH 10/57] chore: update used-by badge by github-actions[bot] (#55) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52243dd..9425a29 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=21&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=24&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From 9852b05c06e9b15c6b49d999e7267943a73f044c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:08:16 +0300 Subject: [PATCH 11/57] chore: update used-by badge by github-actions[bot] (#56) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9425a29..f9c4bd2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=24&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=26&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From e9dff429d2db882901d8f3bc3516ce6cd95550c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 06:51:04 +0300 Subject: [PATCH 12/57] chore(deps): bump commit-check from 0.8.0 to 0.8.1 (#57) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 80b0de5..1468d15 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.8.0 +commit-check==0.8.1 From bf5ea372dc2344645dfc7b8d2db87b0b657b5475 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:13:11 +0300 Subject: [PATCH 13/57] chore: update used-by badge by github-actions[bot] (#58) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f9c4bd2..c56632f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=26&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=27&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From f29561f5c387865c480f6b46a6ab2292d8c10968 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 14:42:25 +0300 Subject: [PATCH 14/57] chore: update used-by badge by github-actions[bot] (#59) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c56632f..5f95842 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=27&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=30&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From c9ea3b86dadd89acbbb1747488d1442ff5e1977e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:10:38 +0300 Subject: [PATCH 15/57] chore: update used-by badge by github-actions[bot] (#60) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f95842..40b66b2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=30&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=35&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From da70798a7fc9d0615da4a3ee849d322651b74f84 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 10:07:41 +0300 Subject: [PATCH 16/57] chore(deps): bump peter-evans/create-pull-request from 6 to 7 (#62) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/used-by.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/used-by.yml b/.github/workflows/used-by.yml index 2774628..164c8b5 100644 --- a/.github/workflows/used-by.yml +++ b/.github/workflows/used-by.yml @@ -21,7 +21,7 @@ jobs: update-badge: 'true' - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v7 with: add-paths: "README.md" # the file path to commit commit-message: "chore: update used-by badge by github-actions[bot]" From 6d4827bde6819a533f068c8053415f0f5c09bea0 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 11 Sep 2024 10:32:37 +0300 Subject: [PATCH 17/57] docs: update README.md (#63) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 40b66b2..d2f7836 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ jobs: ### `branch` - **Description**: check git branch naming convention. - - By default follow bitbucket [branching model](https://support.atlassian.com/bitbucket-cloud/docs/configure-a-projects-branching-model/). + - By default follow bitbucket [conventional branch](https://conventional-branch.github.io/en/posts/). - Default: 'true' ### `author-name` From f30090e9a9835fdc38403f54d322f7e6655dfa89 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 12 Sep 2024 16:29:49 +0300 Subject: [PATCH 18/57] docs: update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2f7836..13d88bb 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ jobs: ### `branch` - **Description**: check git branch naming convention. - - By default follow bitbucket [conventional branch](https://conventional-branch.github.io/en/posts/). + - By default follow bitbucket [conventional branch](https://conventional-branch.github.io/posts/). - Default: 'true' ### `author-name` From 66d01e92ce51d0d10d21796c88ee0f27bdddf38a Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 13 Sep 2024 13:32:38 +0300 Subject: [PATCH 19/57] docs: update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13d88bb..2fddcf5 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ jobs: ### `branch` - **Description**: check git branch naming convention. - - By default follow bitbucket [conventional branch](https://conventional-branch.github.io/posts/). + - By default follow bitbucket [conventional branch](https://conventional-branch.github.io/). - Default: 'true' ### `author-name` From e33ab58ca44694ee6fb249a559663abfe6dc192c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:06:28 +0300 Subject: [PATCH 20/57] chore(deps): bump commit-check from 0.8.1 to 0.8.2 (#64) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.8.1 to 0.8.2. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.8.1...v0.8.2) --- updated-dependencies: - dependency-name: commit-check dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1468d15..cf993b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.8.1 +commit-check==0.8.2 From 1cb64d4f6c07aa4f2a44cce99afd9b605eb9c58d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 5 Oct 2024 04:09:28 +0300 Subject: [PATCH 21/57] chore(deps): bump commit-check from 0.8.2 to 0.8.3 (#65) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cf993b3..cd2611c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.8.2 +commit-check==0.8.3 From 037db85508e773b7939080f16a518d6f294c9e45 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:45:57 +0300 Subject: [PATCH 22/57] chore: update used-by badge by github-actions[bot] (#61) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fddcf5..426ff0e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=35&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=37&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From af46d575ede7e889ca620fa8f8230ec08b50b24b Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Mon, 14 Oct 2024 11:05:58 +0300 Subject: [PATCH 23/57] fix: use virtual environment to adopt PEP 668 (#67) * use virtual environment * fix: FileNotFoundError of commit-check * fix: merge two step to one step --- action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 7a1823d..833ba66 100644 --- a/action.yml +++ b/action.yml @@ -36,17 +36,17 @@ inputs: runs: using: "composite" steps: - - name: Install action dependencies + - name: Install dependencies and run commit-check shell: bash run: | if [[ "$RUNNER_OS" == "Linux" ]]; then # https://github.com/pypa/setuptools/issues/3269 export DEB_PYTHON_INSTALL_LAYOUT=deb fi + python3 -m venv venv + source venv/bin/activate python3 -m pip install -r "$GITHUB_ACTION_PATH/requirements.txt" - - name: Run commit-check - shell: bash - run: python3 ${{ github.action_path }}/main.py + python3 "$GITHUB_ACTION_PATH/main.py" env: MESSAGE: ${{ inputs.message }} BRANCH: ${{ inputs.branch }} From d8abd675904f08e4c654c2617bf3915775f917cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:13:59 +0300 Subject: [PATCH 24/57] chore(deps): bump shenxianpeng/used-by from 0.1.2 to 0.1.3 (#68) Bumps [shenxianpeng/used-by](https://github.com/shenxianpeng/used-by) from 0.1.2 to 0.1.3. - [Release notes](https://github.com/shenxianpeng/used-by/releases) - [Commits](https://github.com/shenxianpeng/used-by/compare/v0.1.2...v0.1.3) --- updated-dependencies: - dependency-name: shenxianpeng/used-by dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/used-by.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/used-by.yml b/.github/workflows/used-by.yml index 164c8b5..676634d 100644 --- a/.github/workflows/used-by.yml +++ b/.github/workflows/used-by.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: shenxianpeng/used-by@v0.1.2 + - uses: shenxianpeng/used-by@v0.1.3 with: repo: '${{ github.repository }}' update-badge: 'true' From a64fe4902507fb833d5f0a2eaaeb7c31bd022450 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 12:11:49 +0300 Subject: [PATCH 25/57] chore(deps): bump shenxianpeng/used-by from 0.1.3 to 0.1.4 (#69) Bumps [shenxianpeng/used-by](https://github.com/shenxianpeng/used-by) from 0.1.3 to 0.1.4. - [Release notes](https://github.com/shenxianpeng/used-by/releases) - [Commits](https://github.com/shenxianpeng/used-by/compare/v0.1.3...v0.1.4) --- updated-dependencies: - dependency-name: shenxianpeng/used-by dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/used-by.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/used-by.yml b/.github/workflows/used-by.yml index 676634d..0625b49 100644 --- a/.github/workflows/used-by.yml +++ b/.github/workflows/used-by.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: shenxianpeng/used-by@v0.1.3 + - uses: shenxianpeng/used-by@v0.1.4 with: repo: '${{ github.repository }}' update-badge: 'true' From f0c526962623d29d5ec7875379eacb9c445aa06b Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sat, 19 Oct 2024 10:54:48 +0300 Subject: [PATCH 26/57] fix: Checkout PR HEAD commit instead of merge commit (#72) * update .gitignore file * fix: Update commit-check.yml --- .github/workflows/commit-check.yml | 2 ++ .gitignore | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 967657d..96d775a 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -10,6 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} - uses: ./ # self test with: message: true diff --git a/.gitignore b/.gitignore index f7275bb..43f4b6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ venv/ +.venv/ From 785d02ea79d4e5562869d50f056cd7075187f624 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 22 Oct 2024 22:43:32 +0300 Subject: [PATCH 27/57] feat: Support posting pull request comments (#71) * feat: support add pull request comments * add .pre-commit-config.yaml to format code * fix: requirements.txt and test new input * fix: just checking PR_COMMENTS * feat: add GITHUB_TOKEN * update readme.md * update exiting comments or delete it to add new one * try to fix 'Issue' object has no attribute 'get_issue_comments' * update .commit-check.yml * try to fix posting issue comment * docs: update readme * docs: update links --- .commit-check.yml | 12 +- .github/workflows/commit-check.yml | 3 + .pre-commit-config.yaml | 28 +++++ README.md | 30 ++++- action.yml | 7 +- main.py | 182 +++++++++++++++++++++++------ requirements.txt | 2 + 7 files changed, 218 insertions(+), 46 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.commit-check.yml b/.commit-check.yml index bfabe35..15ac7e4 100644 --- a/.commit-check.yml +++ b/.commit-check.yml @@ -7,19 +7,19 @@ checks: [optional body]\n [optional footer(s)]\n\n More details please refer to https://www.conventionalcommits.org" - suggest: git commit --amend --no-verify + suggest: please check your commit message whether matches above regex - check: branch - regex: ^(bugfix|feature|release|hotfix|task|dependabot)\/.+|(master)|(main)|(HEAD)|(PR-.+) - error: "Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/" - suggest: git checkout -b type/branch_name + regex: ^(bugfix|feature|release|hotfix|task|chore)\/.+|(master)|(main)|(HEAD)|(PR-.+) + error: "Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/ chore/" + suggest: run command `git checkout -b type/branch_name` - check: author_name regex: ^[A-Za-z ,.\'-]+$|.*(\[bot]) error: The committer name seems invalid - suggest: git config user.name "Peter Shen" + suggest: run command `git config user.name "Your Name"` - check: author_email regex: ^\S+@\S+\.\S+$ error: The committer email seems invalid - suggest: git config user.email petershen@example.com + suggest: run command `git config user.email yourname@example.com` diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 96d775a..ecea18c 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -13,6 +13,8 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - uses: ./ # self test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # used by `pr-comments` with: message: true branch: true @@ -20,3 +22,4 @@ jobs: author-email: true commit-signoff: true job-summary: true + pr-comments: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b45ec09 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +# https://pre-commit.com/ +ci: + autofix_commit_msg: 'ci: auto fixes from pre-commit.com hooks' + autoupdate_commit_msg: 'ci: pre-commit autoupdate' + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-yaml + - id: check-toml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: name-tests-test + - id: requirements-txt-fixer +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.10.0 + hooks: + - id: black +# FIXME: main.py:109: error: Item "None" of "str | None" has no attribute "split" [union-attr] +# - repo: https://github.com/pre-commit/mirrors-mypy +# rev: v1.12.0 +# hooks: +# - id: mypy +- repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell diff --git a/README.md b/README.md index 426ff0e..c9a2679 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} # Checkout PR HEAD commit - uses: commit-check/commit-check-action@v1 with: message: true @@ -34,6 +36,7 @@ jobs: commit-signoff: true dry-run: true job-summary: true + pr-comments: true ``` ## Optional Inputs @@ -72,22 +75,41 @@ jobs: ### `job-summary` -- **Description**: display job summary to a workflow run +- **Description**: display job summary to the workflow run - Default: 'true' +### `pr-comments` + +- **Description**: post results to the pull request comments +- Default: 'true' + +> [!IMPORTANT] +> This is a experimental feature +> use it you need to set `GITHUB_TOKEN` in the GitHub Action. + Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check/blob/main/.commit-check.yml), if you want to customize just add your `.commit-check.yml` config file under your repository root directory. ## GitHub Action job summary -By default, commit-check-action results are shown on the job summary page of the workflow. +By default, commit-check-action results are shown on the job summary page of the workflow. ### Success job summary -![Success job summary](https://github.com/commit-check/.github/blob/main/screenshot/success-summary.png) +![Success job summary](https://github.com/commit-check/.github/blob/main/screenshot/success-job-summary.png) ### Failure job summary -![Failure job summary](https://github.com/commit-check/.github/blob/main/screenshot/failure-summary.png) +![Failure job summary](https://github.com/commit-check/.github/blob/main/screenshot/failure-job-summary.png) + +## GitHub Pull Request comments + +### Success pull request comment + +![Success pull request comment](https://github.com/commit-check/.github/blob/main/screenshot/success-pr-comments.png) + +### Failure pull request comment + +![Failure pull request comment](https://github.com/commit-check/.github/blob/main/screenshot/failure-pr-comments.png) ## Badging your repository diff --git a/action.yml b/action.yml index 833ba66..804f81c 100644 --- a/action.yml +++ b/action.yml @@ -30,7 +30,11 @@ inputs: required: false default: false job-summary: - description: add a job summary + description: display job summary to the workflow run + required: false + default: true + pr-comments: + description: post results to the pull request comments required: false default: true runs: @@ -55,3 +59,4 @@ runs: COMMIT_SIGNOFF: ${{ inputs.commit-signoff }} DRY_RUN: ${{ inputs.dry-run }} JOB_SUMMARY: ${{ inputs.job-summary }} + PR_COMMENTS: ${{ inputs.pr-comments }} diff --git a/main.py b/main.py index 2b07aec..eb0af9c 100755 --- a/main.py +++ b/main.py @@ -3,59 +3,171 @@ import sys import subprocess import re +from github import Github + + +# Constants for message titles +SUCCESS_TITLE = "# Commit-Check ✔️" +FAILURE_TITLE = "# Commit-Check ❌" + +# Environment variables +MESSAGE = os.getenv("MESSAGE", "false") +BRANCH = os.getenv("BRANCH", "false") +AUTHOR_NAME = os.getenv("AUTHOR_NAME", "false") +AUTHOR_EMAIL = os.getenv("AUTHOR_EMAIL", "false") +COMMIT_SIGNOFF = os.getenv("COMMIT_SIGNOFF", "false") +DRY_RUN = os.getenv("DRY_RUN", "false") +JOB_SUMMARY = os.getenv("JOB_SUMMARY", "false") +PR_COMMENTS = os.getenv("PR_COMMENTS", "false") +GITHUB_STEP_SUMMARY = os.environ["GITHUB_STEP_SUMMARY"] +GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") +GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY") +GITHUB_REF = os.getenv("GITHUB_REF") + + +def log_env_vars(): + """Logs the environment variables for debugging purposes.""" + print(f"MESSAGE = {MESSAGE}") + print(f"BRANCH = {BRANCH}") + print(f"AUTHOR_NAME = {AUTHOR_NAME}") + print(f"AUTHOR_EMAIL = {AUTHOR_EMAIL}") + print(f"COMMIT_SIGNOFF = {COMMIT_SIGNOFF}") + print(f"DRY_RUN = {DRY_RUN}") + print(f"JOB_SUMMARY = {JOB_SUMMARY}") + print(f"PR_COMMENTS = {PR_COMMENTS}\n") def run_commit_check() -> int: - args = ["--message", "--branch", "--author-name", "--author-email", "--commit-signoff"] - args = [arg for arg, value in zip(args, [MESSAGE, BRANCH, AUTHOR_NAME, AUTHOR_EMAIL, COMMIT_SIGNOFF]) if value == "true"] + """Runs the commit-check command and logs the result.""" + args = [ + "--message", + "--branch", + "--author-name", + "--author-email", + "--commit-signoff", + ] + args = [ + arg + for arg, value in zip( + args, [MESSAGE, BRANCH, AUTHOR_NAME, AUTHOR_EMAIL, COMMIT_SIGNOFF] + ) + if value == "true" + ] command = ["commit-check"] + args print(" ".join(command)) with open("result.txt", "w") as result_file: - result = subprocess.run(command, stdout=result_file, stderr=subprocess.PIPE, check=False) + result = subprocess.run( + command, stdout=result_file, stderr=subprocess.PIPE, check=False + ) return result.returncode +def read_result_file() -> str | None: + """Reads the result.txt file and removes ANSI color codes.""" + if os.path.getsize("result.txt") > 0: + with open("result.txt", "r") as result_file: + result_text = re.sub( + r"\x1B\[[0-9;]*[a-zA-Z]", "", result_file.read() + ) # Remove ANSI colors + return result_text.rstrip() + return None + + def add_job_summary() -> int: + """Adds the commit check result to the GitHub job summary.""" if JOB_SUMMARY == "false": - sys.exit() + return 0 - if os.path.getsize("result.txt") > 0: - with open("result.txt", "r") as result_file: - result_text = re.sub(r'\x1B\[[0-9;]*[a-zA-Z]', '', result_file.read()) # Remove ANSI colors + result_text = read_result_file() - with open(GITHUB_STEP_SUMMARY, "a") as summary_file: - summary_file.write("### Commit-Check ❌\n```\n") - summary_file.write(result_text) - summary_file.write("```") - return 1 - else: - with open(GITHUB_STEP_SUMMARY, "a") as summary_file: - summary_file.write("### Commit-Check ✔️\n") + summary_content = ( + SUCCESS_TITLE + if result_text is None + else f"{FAILURE_TITLE}\n```\n{result_text}\n```" + ) + + with open(GITHUB_STEP_SUMMARY, "a") as summary_file: + summary_file.write(summary_content) + + return 0 if result_text is None else 1 + + +def add_pr_comments() -> int: + """Posts the commit check result as a comment on the pull request.""" + if PR_COMMENTS == "false": return 0 + try: + token = os.getenv("GITHUB_TOKEN") + repo_name = os.getenv("GITHUB_REPOSITORY") + pr_number = os.getenv("GITHUB_REF").split("/")[-2] -MESSAGE = os.getenv("MESSAGE", "false") -BRANCH = os.getenv("BRANCH", "false") -AUTHOR_NAME = os.getenv("AUTHOR_NAME", "false") -AUTHOR_EMAIL = os.getenv("AUTHOR_EMAIL", "false") -COMMIT_SIGNOFF = os.getenv("COMMIT_SIGNOFF", "false") -DRY_RUN = os.getenv("DRY_RUN", "false") -JOB_SUMMARY = os.getenv("JOB_SUMMARY", "false") -GITHUB_STEP_SUMMARY = os.environ["GITHUB_STEP_SUMMARY"] + # Initialize GitHub client + g = Github(token) + repo = g.get_repo(repo_name) + pull_request = repo.get_issue(int(pr_number)) + + # Prepare comment content + result_text = read_result_file() + pr_comments = ( + SUCCESS_TITLE + if result_text is None + else f"{FAILURE_TITLE}\n```\n{result_text}\n```" + ) + + # Fetch all existing comments on the PR + comments = pull_request.get_comments() + + # Track if we found a matching comment + matching_comments = [] + last_comment = None + + for comment in comments: + if comment.body.startswith(SUCCESS_TITLE) or comment.body.startswith( + FAILURE_TITLE + ): + matching_comments.append(comment) + if matching_comments: + last_comment = matching_comments[-1] + + if last_comment.body == pr_comments: + print(f"PR comment already up-to-date for PR #{pr_number}.") + return 0 + else: + # If the last comment doesn't match, update it + print(f"Updating the last comment on PR #{pr_number}.") + last_comment.edit(pr_comments) + + # Delete all older matching comments + for comment in matching_comments[:-1]: + print(f"Deleting an old comment on PR #{pr_number}.") + comment.delete() + else: + # No matching comments, create a new one + print(f"Creating a new comment on PR #{pr_number}.") + pull_request.create_comment(body=pr_comments) + + return 0 if result_text is None else 1 + except Exception as e: + print(f"Error posting PR comment: {e}", file=sys.stderr) + return 1 + + +def main(): + """Main function to run commit-check, add job summary and post PR comments.""" + log_env_vars() + + # Combine return codes + ret_code = run_commit_check() + ret_code += add_job_summary() + ret_code += add_pr_comments() -print(f"MESSAGE = {MESSAGE}") -print(f"BRANCH = {BRANCH}") -print(f"AUTHOR_NAME = {AUTHOR_NAME}") -print(f"AUTHOR_EMAIL = {AUTHOR_EMAIL}") -print(f"COMMIT_SIGNOFF = {COMMIT_SIGNOFF}") -print(f"DRY_RUN = {DRY_RUN}") -print(f"JOB_SUMMARY = {JOB_SUMMARY}\n") + if DRY_RUN == "true": + ret_code = 0 -ret_code = run_commit_check() -ret_code += add_job_summary() # Combine return codes + sys.exit(ret_code) -if DRY_RUN == "true": - ret_code = 0 -sys.exit(ret_code) +if __name__ == "__main__": + main() diff --git a/requirements.txt b/requirements.txt index cd2611c..8a6ff3f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check commit-check==0.8.3 +# Interact with the GitHub API. +PyGithub==2.4.0 From 8dd06d69cc6ab29926e827814ad389592f90a048 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:33:28 +0200 Subject: [PATCH 28/57] chore(deps): bump commit-check from 0.8.3 to 0.8.4 (#73) * chore(deps): bump commit-check from 0.8.3 to 0.8.4 Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.8.3 to 0.8.4. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.8.3...v0.8.4) --- updated-dependencies: - dependency-name: commit-check dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * fix: add permissions for pr-comments --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: shenxianpeng --- .github/workflows/commit-check.yml | 5 +++++ requirements.txt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index ecea18c..3b939d2 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -5,6 +5,11 @@ on: branches: 'main' workflow_dispatch: +permissions: + contents: write + pull-requests: write + repository-projects: write + jobs: commit-check: runs-on: ubuntu-latest diff --git a/requirements.txt b/requirements.txt index 8a6ff3f..5fa521b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.8.3 +commit-check==0.8.4 # Interact with the GitHub API. PyGithub==2.4.0 From ef290751b8cff84a1e2f20ce9a983f339c765bdc Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 29 Oct 2024 10:46:23 +0200 Subject: [PATCH 29/57] chore: update commit-check.yml (#76) --- .github/workflows/commit-check.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 3b939d2..422d944 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -5,14 +5,13 @@ on: branches: 'main' workflow_dispatch: -permissions: - contents: write - pull-requests: write - repository-projects: write - jobs: commit-check: runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + repository-projects: write steps: - uses: actions/checkout@v4 with: @@ -27,4 +26,4 @@ jobs: author-email: true commit-signoff: true job-summary: true - pr-comments: true + pr-comments: ${{ github.event_name == 'pull_request' }} From 1ccc4e4dc575bb3a6ae804265be202238c65827e Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Tue, 29 Oct 2024 05:12:16 -0500 Subject: [PATCH 30/57] doc(example): set permissions and only post on pr (#75) Update the example so it only attempts to post comments on the PR action and set the permissions fields to the minimum values required to leave comments on PRs. Signed-off-by: Randolph Sapp Co-authored-by: shenxianpeng --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c9a2679..1646fb9 100644 --- a/README.md +++ b/README.md @@ -23,20 +23,25 @@ on: jobs: commit-check: runs-on: ubuntu-latest + permissions: + contents: read + issues: write + pull-requests: write steps: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} # Checkout PR HEAD commit - uses: commit-check/commit-check-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: message: true branch: true author-name: true author-email: true commit-signoff: true - dry-run: true job-summary: true - pr-comments: true + pr-comments: ${{ github.event_name == 'pull_request' }} ``` ## Optional Inputs From 527965ea82d62b19b6708770725863adcf266cf0 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 29 Oct 2024 15:03:16 +0200 Subject: [PATCH 31/57] chore: update commit-check.yml (#79) * chore: update commit-check.yml * feat: update reamde and commit-check config file * fix: test self --- .commit-check.yml | 2 +- .github/workflows/commit-check.yml | 9 ++++----- README.md | 7 +++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.commit-check.yml b/.commit-check.yml index 15ac7e4..7d5e579 100644 --- a/.commit-check.yml +++ b/.commit-check.yml @@ -20,6 +20,6 @@ checks: suggest: run command `git config user.name "Your Name"` - check: author_email - regex: ^\S+@\S+\.\S+$ + regex: ^.+@.+$ error: The committer email seems invalid suggest: run command `git config user.email yourname@example.com` diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 422d944..7ee0be4 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -8,17 +8,16 @@ on: jobs: commit-check: runs-on: ubuntu-latest - permissions: + permissions: # use permissions because of use pr-comments contents: read pull-requests: write - repository-projects: write steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha }} - - uses: ./ # self test + ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit + - uses: ./ # self test env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # used by `pr-comments` + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because of use pr-comments with: message: true branch: true diff --git a/README.md b/README.md index 1646fb9..c9a5963 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,16 @@ on: jobs: commit-check: runs-on: ubuntu-latest - permissions: + permissions: # use permissions because of use pr-comments contents: read - issues: write pull-requests: write steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha }} # Checkout PR HEAD commit + ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit - uses: commit-check/commit-check-action@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because of use pr-comments with: message: true branch: true From f87ca4d9034aecb097d022720b200ab1765d2a28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:07:41 +0200 Subject: [PATCH 32/57] chore(deps): bump commit-check from 0.8.4 to 0.8.5 (#80) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.8.4 to 0.8.5. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.8.4...v0.8.5) --- updated-dependencies: - dependency-name: commit-check dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5fa521b..7025a47 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.8.4 +commit-check==0.8.5 # Interact with the GitHub API. PyGithub==2.4.0 From 14da7f5170215cd6cfe498671092de1f37cb1058 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:16:33 +0200 Subject: [PATCH 33/57] chore: update used-by badge by github-actions[bot] (#81) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9a5963..53146a8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=37&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=38&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From 7102c90fccf978fb1c7a0eed5f5456d99223530c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 04:07:22 +0200 Subject: [PATCH 34/57] chore(deps): bump pygithub from 2.4.0 to 2.5.0 (#82) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7025a47..b24952d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ # For details please see: https://github.com/commit-check/commit-check commit-check==0.8.5 # Interact with the GitHub API. -PyGithub==2.4.0 +PyGithub==2.5.0 From e7138ee3e786dbbed0aed33b925b4fef56b4bbd7 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 12 Nov 2024 00:01:53 +0200 Subject: [PATCH 35/57] chore: change `pr-comments` default to `false` and README.md (#83) * docs: update README.md * docs: Update README.md * chore: change pr-comments default value to false --- README.md | 11 ++++++----- action.yml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 53146a8..e58e79c 100644 --- a/README.md +++ b/README.md @@ -85,11 +85,12 @@ jobs: ### `pr-comments` - **Description**: post results to the pull request comments -- Default: 'true' +- Default: 'false' > [!IMPORTANT] -> This is a experimental feature -> use it you need to set `GITHUB_TOKEN` in the GitHub Action. +> `pr-comments` is an experimental feature. To use it you need to set `GITHUB_TOKEN` in the GitHub Action. +> +> This feature currently doesn’t work with forked repositories. For more details, refer to issue [#77](https://github.com/commit-check/commit-check-action/issues/77) Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check/blob/main/.commit-check.yml), if you want to customize just add your `.commit-check.yml` config file under your repository root directory. @@ -117,7 +118,7 @@ By default, commit-check-action results are shown on the job summary page of the ## Badging your repository -You can add a badge to your repository to show your contributors / users that you use commit-check! +You can add a badge to your repository to show your contributors/users that you use commit-check! [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) @@ -140,6 +141,6 @@ reStructuredText Versioning follows [Semantic Versioning](https://semver.org/). -## Have question or feedback? +## Have questions or feedback? To provide feedback (requesting a feature or reporting a bug) please post to [issues](https://github.com/commit-check/commit-check/issues). diff --git a/action.yml b/action.yml index 804f81c..531acb4 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ inputs: pr-comments: description: post results to the pull request comments required: false - default: true + default: false runs: using: "composite" steps: From 92872c16f71e695fce71caf21acc9a4036e67252 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 11:31:45 +0200 Subject: [PATCH 36/57] chore(deps): bump commit-check from 0.8.5 to 0.9.0 (#84) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.8.5 to 0.9.0. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.8.5...v0.9.0) --- updated-dependencies: - dependency-name: commit-check dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b24952d..6a6deae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.8.5 +commit-check==0.9.0 # Interact with the GitHub API. PyGithub==2.5.0 From cedb118b3582243c813f767bb2c9195c85d27187 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:29:49 +0200 Subject: [PATCH 37/57] chore(deps): bump commit-check from 0.9.0 to 0.9.1 (#87) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.9.0 to 0.9.1. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.9.0...v0.9.1) --- updated-dependencies: - dependency-name: commit-check dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6a6deae..e13f4c3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.9.0 +commit-check==0.9.1 # Interact with the GitHub API. PyGithub==2.5.0 From 8d507e12899a9feb405c3ed546252ff9508724e0 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 12 Nov 2024 20:36:06 +0200 Subject: [PATCH 38/57] feat: support `merge-base` input (#86) * feat: add a empty commit to main for testing * feat: support merge-base option #85 * test: update commit-check.yml to debug * test: checkout all branches and tags * feat: add a empty commit to main for testing * docs: update readme * test: update merge_base regex * fix: update .commit-check.yml * docs: update README.md --- .commit-check.yml | 5 +++++ .github/workflows/commit-check.yml | 2 ++ README.md | 26 +++++++++++++++++++------- action.yml | 5 +++++ main.py | 5 ++++- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/.commit-check.yml b/.commit-check.yml index 7d5e579..35052d6 100644 --- a/.commit-check.yml +++ b/.commit-check.yml @@ -23,3 +23,8 @@ checks: regex: ^.+@.+$ error: The committer email seems invalid suggest: run command `git config user.email yourname@example.com` + + - check: merge_base + regex: main # it can be master, develop, devel etc based on your project. + error: Current branch is not rebased onto target branch + suggest: please ensure your branch is rebased with the target branch diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 7ee0be4..dc398fd 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -15,6 +15,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit + fetch-depth: 0 # fetch all history for all branches and tags - uses: ./ # self test env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because of use pr-comments @@ -24,5 +25,6 @@ jobs: author-name: true author-email: true commit-signoff: true + merge-base: true job-summary: true pr-comments: ${{ github.event_name == 'pull_request' }} diff --git a/README.md b/README.md index e58e79c..a25d56f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit + fetch-depth: 0 # required for merge-base check - uses: commit-check/commit-check-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because of use pr-comments @@ -39,6 +40,7 @@ jobs: author-name: true author-email: true commit-signoff: true + merge-base: false job-summary: true pr-comments: ${{ github.event_name == 'pull_request' }} ``` @@ -59,19 +61,29 @@ jobs: ### `author-name` -- **Description**: check committer author name +- **Description**: check committer author name. - Default: 'true' ### `author-email` -- **Description**: check committer author email +- **Description**: check committer author email. - Default: 'true' ### `commit-signoff` -- **Description**: check committer commit signature +- **Description**: check committer commit signature. - Default: 'true' +### `merge-base` + +- **Description**: check current branch is rebased onto target branch. +- Default: 'false' + +> [!IMPORTANT] +> `merge-base` is an experimental feature. by default it's disable. +> +> To use this feature, you need fetch all history for all branches by setting `fetch-depth: 0` in `actions/checkout`. + ### `dry-run` - **Description**: run checks without failing. exit code is 0 otherwise is 1. @@ -79,18 +91,18 @@ jobs: ### `job-summary` -- **Description**: display job summary to the workflow run +- **Description**: display job summary to the workflow run. - Default: 'true' ### `pr-comments` -- **Description**: post results to the pull request comments +- **Description**: post results to the pull request comments. - Default: 'false' > [!IMPORTANT] -> `pr-comments` is an experimental feature. To use it you need to set `GITHUB_TOKEN` in the GitHub Action. +> `pr-comments` is an experimental feature. by default it's disable. To use it you need to set `GITHUB_TOKEN` in the GitHub Action. > -> This feature currently doesn’t work with forked repositories. For more details, refer to issue [#77](https://github.com/commit-check/commit-check-action/issues/77) +> This feature currently doesn’t work with forked repositories. For more details, refer to issue [#77](https://github.com/commit-check/commit-check-action/issues/77). Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check/blob/main/.commit-check.yml), if you want to customize just add your `.commit-check.yml` config file under your repository root directory. diff --git a/action.yml b/action.yml index 531acb4..d23acfc 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,10 @@ inputs: description: check committer commit signature required: false default: true + merge-base: + description: check current branch is rebased onto target branch + required: false + default: false dry-run: description: run checks without failing required: false @@ -57,6 +61,7 @@ runs: AUTHOR_NAME: ${{ inputs.author-name }} AUTHOR_EMAIL: ${{ inputs.author-email }} COMMIT_SIGNOFF: ${{ inputs.commit-signoff }} + MERGE_BASE: ${{ inputs.merge-base }} DRY_RUN: ${{ inputs.dry-run }} JOB_SUMMARY: ${{ inputs.job-summary }} PR_COMMENTS: ${{ inputs.pr-comments }} diff --git a/main.py b/main.py index eb0af9c..91d2246 100755 --- a/main.py +++ b/main.py @@ -16,6 +16,7 @@ AUTHOR_NAME = os.getenv("AUTHOR_NAME", "false") AUTHOR_EMAIL = os.getenv("AUTHOR_EMAIL", "false") COMMIT_SIGNOFF = os.getenv("COMMIT_SIGNOFF", "false") +MERGE_BASE = os.getenv("MERGE_BASE", "false") DRY_RUN = os.getenv("DRY_RUN", "false") JOB_SUMMARY = os.getenv("JOB_SUMMARY", "false") PR_COMMENTS = os.getenv("PR_COMMENTS", "false") @@ -32,6 +33,7 @@ def log_env_vars(): print(f"AUTHOR_NAME = {AUTHOR_NAME}") print(f"AUTHOR_EMAIL = {AUTHOR_EMAIL}") print(f"COMMIT_SIGNOFF = {COMMIT_SIGNOFF}") + print(f"MERGE_BASE = {MERGE_BASE}") print(f"DRY_RUN = {DRY_RUN}") print(f"JOB_SUMMARY = {JOB_SUMMARY}") print(f"PR_COMMENTS = {PR_COMMENTS}\n") @@ -45,11 +47,12 @@ def run_commit_check() -> int: "--author-name", "--author-email", "--commit-signoff", + "--merge-base", ] args = [ arg for arg, value in zip( - args, [MESSAGE, BRANCH, AUTHOR_NAME, AUTHOR_EMAIL, COMMIT_SIGNOFF] + args, [MESSAGE, BRANCH, AUTHOR_NAME, AUTHOR_EMAIL, COMMIT_SIGNOFF, MERGE_BASE] ) if value == "true" ] From 1ab8377c687393a441c2a953413925398cbd28fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:22:54 +0200 Subject: [PATCH 39/57] chore(deps): bump commit-check from 0.9.1 to 0.9.2 (#88) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e13f4c3..fdcf08c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.9.1 +commit-check==0.9.2 # Interact with the GitHub API. PyGithub==2.5.0 From 4a509ea5098fa2e24945649d9198e1aece898733 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 1 Dec 2024 21:18:21 +0200 Subject: [PATCH 40/57] docs: update readme.md (#89) --- README.md | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a25d56f..e96d3d3 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,15 @@ A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. +## Table of Contents + +* [Usage](#usage) +* [Optional Inputs](#optional-inputs) +* [GitHub Action Job Summary](#github-action-job-summary) +* [GitHub Pull Request Comments](#github-pull-request-comments) +* [Badging Your Repository](#badging-your-repository) +* [Versioning](#versioning) + ## Usage Create a new GitHub Actions workflow in your project, e.g. at [.github/workflows/commit-check.yml](.github/workflows/commit-check.yml) @@ -51,33 +60,33 @@ jobs: - **Description**: check commit message formatting convention. - By default the rule follows [conventional commits](https://www.conventionalcommits.org/). -- Default: 'true' +- Default: `true` ### `branch` - **Description**: check git branch naming convention. - By default follow bitbucket [conventional branch](https://conventional-branch.github.io/). -- Default: 'true' +- Default: `true` ### `author-name` - **Description**: check committer author name. -- Default: 'true' +- Default: `true` ### `author-email` - **Description**: check committer author email. -- Default: 'true' +- Default: `true` ### `commit-signoff` - **Description**: check committer commit signature. -- Default: 'true' +- Default: `true` ### `merge-base` - **Description**: check current branch is rebased onto target branch. -- Default: 'false' +- Default: `false` > [!IMPORTANT] > `merge-base` is an experimental feature. by default it's disable. @@ -87,17 +96,17 @@ jobs: ### `dry-run` - **Description**: run checks without failing. exit code is 0 otherwise is 1. -- Default: 'false' +- Default: `false` ### `job-summary` - **Description**: display job summary to the workflow run. -- Default: 'true' +- Default: `true` ### `pr-comments` - **Description**: post results to the pull request comments. -- Default: 'false' +- Default: `false` > [!IMPORTANT] > `pr-comments` is an experimental feature. by default it's disable. To use it you need to set `GITHUB_TOKEN` in the GitHub Action. @@ -106,29 +115,29 @@ jobs: Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check/blob/main/.commit-check.yml), if you want to customize just add your `.commit-check.yml` config file under your repository root directory. -## GitHub Action job summary +## GitHub Action Job Summary By default, commit-check-action results are shown on the job summary page of the workflow. -### Success job summary +### Success Job Summary ![Success job summary](https://github.com/commit-check/.github/blob/main/screenshot/success-job-summary.png) -### Failure job summary +### Failure Job Summary ![Failure job summary](https://github.com/commit-check/.github/blob/main/screenshot/failure-job-summary.png) -## GitHub Pull Request comments +## GitHub Pull Request Comments -### Success pull request comment +### Success Pull Request Comment ![Success pull request comment](https://github.com/commit-check/.github/blob/main/screenshot/success-pr-comments.png) -### Failure pull request comment +### Failure Pull Request Comment ![Failure pull request comment](https://github.com/commit-check/.github/blob/main/screenshot/failure-pr-comments.png) -## Badging your repository +## Badging Your Repository You can add a badge to your repository to show your contributors/users that you use commit-check! From cd614c1cb08de72a55a5ec4aaab7f30ca9ba4d69 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 8 Dec 2024 22:23:12 +0200 Subject: [PATCH 41/57] feat: print error log in github action (#91) * feat: print error log in github action * feat: add pre-commit.yml * chore: add type to function --- .github/workflows/pre-commit.yml | 10 ++++++++++ .pre-commit-config.yaml | 9 ++++----- README.md | 2 +- main.py | 32 ++++++++++++++++++++++++++++---- 4 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..7ee1b19 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,10 @@ +name: Run pre-commit + +on: + push: + pull_request: + types: opened + +jobs: + pre-commit: + uses: commit-check/.github/.github/workflows/pre-commit.yml@main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b45ec09..571d5ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,11 +17,10 @@ repos: rev: 24.10.0 hooks: - id: black -# FIXME: main.py:109: error: Item "None" of "str | None" has no attribute "split" [union-attr] -# - repo: https://github.com/pre-commit/mirrors-mypy -# rev: v1.12.0 -# hooks: -# - id: mypy +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.12.0 + hooks: + - id: mypy - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: diff --git a/README.md b/README.md index e96d3d3..5bd3919 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ jobs: > [!IMPORTANT] > `merge-base` is an experimental feature. by default it's disable. -> +> > To use this feature, you need fetch all history for all branches by setting `fetch-depth: 0` in `actions/checkout`. ### `dry-run` diff --git a/main.py b/main.py index 91d2246..87434ec 100755 --- a/main.py +++ b/main.py @@ -3,7 +3,7 @@ import sys import subprocess import re -from github import Github +from github import Github # type: ignore # Constants for message titles @@ -52,7 +52,8 @@ def run_commit_check() -> int: args = [ arg for arg, value in zip( - args, [MESSAGE, BRANCH, AUTHOR_NAME, AUTHOR_EMAIL, COMMIT_SIGNOFF, MERGE_BASE] + args, + [MESSAGE, BRANCH, AUTHOR_NAME, AUTHOR_EMAIL, COMMIT_SIGNOFF, MERGE_BASE], ) if value == "true" ] @@ -104,7 +105,12 @@ def add_pr_comments() -> int: try: token = os.getenv("GITHUB_TOKEN") repo_name = os.getenv("GITHUB_REPOSITORY") - pr_number = os.getenv("GITHUB_REF").split("/")[-2] + pr_number = os.getenv("GITHUB_REF") + if pr_number is not None: + pr_number = pr_number.split("/")[-2] + else: + # Handle the case where GITHUB_REF is not set + raise ValueError("GITHUB_REF environment variable is not set") # Initialize GitHub client g = Github(token) @@ -157,6 +163,23 @@ def add_pr_comments() -> int: return 1 +def log_error_and_exit( + failure_title: str, result_text: str | None, ret_code: int +) -> None: + """ + Logs an error message to GitHub Actions and exits with the specified return code. + + Args: + failure_title (str): The title of the failure message. + result_text (str): The detailed result text to include in the error message. + ret_code (int): The return code to exit with. + """ + if result_text: + error_message = f"{failure_title}\n```\n{result_text}\n```" + print(f"::error::{error_message}") + sys.exit(ret_code) + + def main(): """Main function to run commit-check, add job summary and post PR comments.""" log_env_vars() @@ -169,7 +192,8 @@ def main(): if DRY_RUN == "true": ret_code = 0 - sys.exit(ret_code) + result_text = read_result_file() + log_error_and_exit(FAILURE_TITLE, result_text, ret_code) if __name__ == "__main__": From e0cc9e5316ee98e3e3b46587e2a5ceb1cbe0e8b8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:55:13 +0200 Subject: [PATCH 42/57] chore: update used-by badge by github-actions[bot] (#90) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bd3919..904f3ff 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=38&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=43&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From a9e1fa7cfc7bf7e343d035ca39fb10d0f73f93c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:52:03 +0200 Subject: [PATCH 43/57] chore: update used-by badge by github-actions[bot] (#92) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 904f3ff..78bc0df 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=43&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=47&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From 7ad236da3dbc06f7366c04539fac7b1d316c7311 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 26 Jan 2025 18:06:38 +0200 Subject: [PATCH 44/57] docs: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78bc0df..8cf7e56 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ jobs: ### `branch` - **Description**: check git branch naming convention. - - By default follow bitbucket [conventional branch](https://conventional-branch.github.io/). + - By default the rule follows [conventional branch](https://conventional-branch.github.io/). - Default: `true` ### `author-name` From 85adfd6817121ee1d974447c148bd7c545cda55a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:39:38 +0200 Subject: [PATCH 45/57] chore(deps): bump commit-check from 0.9.2 to 0.9.3 (#96) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fdcf08c..87cc436 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.9.2 +commit-check==0.9.3 # Interact with the GitHub API. PyGithub==2.5.0 From e3433860d76e5ac2e085b7fba66a313197d5b404 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:36:12 +0200 Subject: [PATCH 46/57] chore: update used-by badge by github-actions[bot] (#95) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8cf7e56..bb7c106 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=47&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=49&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From e6a901f3af3cb43def9dd8dcd864b03dc44a860e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:39:46 +0800 Subject: [PATCH 47/57] chore(deps): bump pygithub from 2.5.0 to 2.6.0 (#99) Bumps [pygithub](https://github.com/pygithub/pygithub) from 2.5.0 to 2.6.0. - [Release notes](https://github.com/pygithub/pygithub/releases) - [Changelog](https://github.com/PyGithub/PyGithub/blob/main/doc/changes.rst) - [Commits](https://github.com/pygithub/pygithub/compare/v2.5.0...v2.6.0) --- updated-dependencies: - dependency-name: pygithub dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 87cc436..fa52544 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ # For details please see: https://github.com/commit-check/commit-check commit-check==0.9.3 # Interact with the GitHub API. -PyGithub==2.5.0 +PyGithub==2.6.0 From 3b406fc3006cde0e64a760fb50063f79027259c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:40:37 +0800 Subject: [PATCH 48/57] chore: update used-by badge by github-actions[bot] (#97) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb7c106..10a43ff 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=49&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=51&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From 59690d7fbb42eb373d0c278db60c1afe83c9b13f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2025 19:51:32 +0800 Subject: [PATCH 49/57] chore(deps): bump pygithub from 2.6.0 to 2.6.1 (#100) Bumps [pygithub](https://github.com/pygithub/pygithub) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/pygithub/pygithub/releases) - [Changelog](https://github.com/PyGithub/PyGithub/blob/v2.6.1/doc/changes.rst) - [Commits](https://github.com/pygithub/pygithub/compare/v2.6.0...v2.6.1) --- updated-dependencies: - dependency-name: pygithub dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fa52544..aae4bb1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ # For details please see: https://github.com/commit-check/commit-check commit-check==0.9.3 # Interact with the GitHub API. -PyGithub==2.6.0 +PyGithub==2.6.1 From ec47d191c2a467428c72aedf8823cc609db0e767 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 22:27:38 +0800 Subject: [PATCH 50/57] chore(deps): bump commit-check from 0.9.3 to 0.9.4 (#103) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index aae4bb1..8b903aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.9.3 +commit-check==0.9.4 # Interact with the GitHub API. PyGithub==2.6.1 From cac2d49b6c81b73cefef7a842f69b872543a18dc Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 25 Feb 2025 01:54:49 +0800 Subject: [PATCH 51/57] fix: update .commit-check.yml (#104) Ref https://github.com/commit-check/commit-check/pull/221 --- .commit-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.commit-check.yml b/.commit-check.yml index 35052d6..f1f725f 100644 --- a/.commit-check.yml +++ b/.commit-check.yml @@ -15,7 +15,7 @@ checks: suggest: run command `git checkout -b type/branch_name` - check: author_name - regex: ^[A-Za-z ,.\'-]+$|.*(\[bot]) + regex: ^[A-Za-zÀ-ÖØ-öø-ÿ\u0100-\u017F\u0180-\u024F ,.\'-]+$|.*(\[bot]) error: The committer name seems invalid suggest: run command `git config user.name "Your Name"` From a14e83e435c351b6bd9a12eea2909ef75d514cf8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 01:57:01 +0800 Subject: [PATCH 52/57] chore: update used-by badge by github-actions[bot] (#102) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 10a43ff..7bba6d8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=51&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=53&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From 9a4f9d029326c8f51a0a672055300fcc2b89d6a3 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Mon, 24 Mar 2025 23:28:27 +0800 Subject: [PATCH 53/57] docs: add used-by section (#106) * docs: add used-by section * docs: add more logo and name --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 7bba6d8..3a5dd8d 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,22 @@ jobs: pr-comments: ${{ github.event_name == 'pull_request' }} ``` +## Used By + +

+ Apache + Apache   + discovery-unicamp + discovery-unicamp   + Texas Instruments + Texas Instruments   + OpenCADC + OpenCADC   + Extrawest + Extrawest + and many more. +

+ ## Optional Inputs ### `message` From 5ea0f66e396dda561c2db397b125c245ef3f133c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:27:09 +0300 Subject: [PATCH 54/57] chore(deps): bump commit-check from 0.9.4 to 0.9.5 (#107) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.9.4 to 0.9.5. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.9.4...v0.9.5) --- updated-dependencies: - dependency-name: commit-check dependency-version: 0.9.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8b903aa..764bb33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Install commit-check CLI # For details please see: https://github.com/commit-check/commit-check -commit-check==0.9.4 +commit-check==0.9.5 # Interact with the GitHub API. PyGithub==2.6.1 From 2f0715bb7ec18b41fdeab08e92a28ee3b5e3daee Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:31:07 +0300 Subject: [PATCH 55/57] chore: update used-by badge by github-actions[bot] (#105) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a5dd8d..73693ac 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=53&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=55&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. From a2873ca0482dd505c93fb51861c953e82fd0a186 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 3 Apr 2025 23:46:30 +0800 Subject: [PATCH 56/57] feat: verify commit-check artifact attestations (#53) * Update action.yml to verify artifact attestations * Update action.yml to add GH_TOKEN * Update action.yml * Update action.yml * Update action.yml * Update action.yml * fix: create virtual env then verify attestations --- action.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d23acfc..cdd75ea 100644 --- a/action.yml +++ b/action.yml @@ -51,9 +51,23 @@ runs: # https://github.com/pypa/setuptools/issues/3269 export DEB_PYTHON_INSTALL_LAYOUT=deb fi + + # Set up virtual environment python3 -m venv venv source venv/bin/activate - python3 -m pip install -r "$GITHUB_ACTION_PATH/requirements.txt" + + # Download artifact + python3 -m pip download -r "$GITHUB_ACTION_PATH/requirements.txt" + + # Verify artifact attestations + if ! gh attestation verify commit_check-*.whl -R commit-check/commit-check; then + echo "Artifact verification failed. Aborting installation." + exit 1 + fi + + # Install artifact + python3 -m pip install commit_check-*.whl PyGithub-*.whl + python3 "$GITHUB_ACTION_PATH/main.py" env: MESSAGE: ${{ inputs.message }} From 188ce79aedf0bbe6bb80bdde87286b39d856a146 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 01:49:28 +0300 Subject: [PATCH 57/57] chore: update used-by badge by github-actions[bot] (#109) Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 73693ac..b1581f8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Main](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/main.yaml) [![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) -[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=55&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) +[![Used by](https://img.shields.io/static/v1?label=Used%20by&message=62&color=informational&logo=slickpic)](https://github.com/commit-check/commit-check-action/network/dependents) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more.