From 42c1fa3bf46e34290d07828ca81489eeee958cb9 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 2 Feb 2023 21:46:45 -0500 Subject: [PATCH 01/99] feat: add job summary (#8) --- .github/workflows/commit-check.yml | 3 +- README.md | 23 +++++++---- action.yml | 42 ++++++-------------- entrypoint | 63 ++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 38 deletions(-) create mode 100755 entrypoint diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 129e694..3c421da 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -2,7 +2,6 @@ name: Commit Check on: push: - branches: 'main' pull_request: branches: 'main' @@ -17,4 +16,4 @@ jobs: branch: true author-name: true author-email: true - dry-run: true + summary: true diff --git a/README.md b/README.md index a1706a1..0eb34c8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,10 @@ Create a new GitHub Actions workflow in your project, e.g. at [.github/workflows ```yaml name: Commit Check -on: pull_request +on: + push: + pull_request: + branches: 'main' jobs: commit-check: @@ -26,20 +29,21 @@ jobs: author-name: true author-email: true dry-run: true + summary: true ``` ## Optional Inputs ### `message` -- **Description**: check commit message formatting convention - - By default the rule follows [conventionalcommits](https://www.conventionalcommits.org/) +- **Description**: check commit message formatting convention. + - By default the rule follows [conventionalcommits](https://www.conventionalcommits.org/). - Default: 'true' ### `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/) +- **Description**: check git branch naming convention. + - By default follow bitbucket [branching model](https://support.atlassian.com/bitbucket-cloud/docs/configure-a-projects-branching-model/). - Default: 'true' ### `author-name` @@ -54,10 +58,15 @@ jobs: ### `dry-run` -- **Description**: run checks without failing +- **Description**: run checks without failing. exit code is 0 otherwise is 1. - Default: 'false' -Note: to change the default rules of above inputs, just add your own [`.commit-check.yml`](.commit-check.yml) config file. +### `summary` + +- **Description**: display job summary to a workflow run +- Default: 'true' + +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. ## Badging your repository diff --git a/action.yml b/action.yml index b842850..ef16335 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: Commit Check Action -description: Check commit message formatting, branch naming, referencing Jira tickets, and more +description: Check commit message formatting, branch naming, committer name, email, and more author: shenxianpeng branding: icon: "git-commit" @@ -25,35 +25,19 @@ inputs: description: run checks without failing required: false default: false + summary: + description: add a job summary + required: false + default: true runs: using: "composite" steps: - - name: Install action dependencies - shell: bash - run: | - if [[ "${{runner.os}}" == "Linux" ]]; then - # https://github.com/pypa/setuptools/issues/3269 - export DEB_PYTHON_INSTALL_LAYOUT=deb - fi - python3 -m pip install -r '${{ github.action_path }}/requirements.txt' - - name: Run commit-check - id: commit-check + - run: ${{ github.action_path }}/entrypoint shell: bash - run: | - args="" - if [ "${{ inputs.message }}" == "true" ]; then - args="$args --message" - fi - if [ "${{ inputs.branch }}" == "true" ]; then - args="$args --branch" - fi - if [ "${{ inputs.author-name }}" == "true" ]; then - args="$args --author-name" - fi - if [ "${{ inputs.author-email }}" == "true" ]; then - args="$args --author-email" - fi - if [ "${{ inputs.dry-run }}" == "true" ]; then - args="$args --dry-run" - fi - commit-check $args + env: + MESSAGE: ${{ inputs.message }} + BRANCH: ${{ inputs.branch }} + AUTHOR_NAME: ${{ inputs.author-name }} + AUTHOR_EMAIL: ${{ inputs.author-email }} + DRY_RUN: ${{ inputs.dry-run }} + SUMMARY: ${{ inputs.summary }} diff --git a/entrypoint b/entrypoint new file mode 100755 index 0000000..697b594 --- /dev/null +++ b/entrypoint @@ -0,0 +1,63 @@ +#!/bin/bash + +ret_code=0 + +install_deps(){ + if [ "$RUNNER_OS" == "Linux" ]; then + # https://github.com/pypa/setuptools/issues/3269 + export DEB_PYTHON_INSTALL_LAYOUT=deb + fi + python3 -m pip install -r requirements.txt +} + +run_commit_check(){ + args="" + if [ "$MESSAGE" == "true" ]; then + args="$args --message" + fi + if [ "$BRANCH" == "true" ]; then + args="$args --branch" + fi + if [ "$AUTHOR_NAME" == "true" ]; then + args="$args --author-name" + fi + if [ "$AUTHOR_EMAIL" == "true" ]; then + args="$args --author-email" + fi + + echo "commit-check $args" + commit-check $args > result.txt + ret_code=$? +} + +add_job_summary(){ + if [ "$SUMMARY" == "false" ]; then + exit + fi + + if [ -s result.txt ]; then + # strips ANSI colors + sed -i "s,\x1B\[[0-9;]*[a-zA-Z],,g" result.txt + cat result.txt + echo "### Commit-Check ❌" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + cat result.txt >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ret_code=1 + else + echo "### Commit-Check ✔️" >> $GITHUB_STEP_SUMMARY + ret_code=0 + fi +} + +# start of main +install_deps +run_commit_check +add_job_summary + +if [ "$DRY_RUN" == "true" ]; then + ret_code=0 +fi + +exit $ret_code +# end of main From 52b84905cd0f6d253d28e920b7f170a7146650fc Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 2 Feb 2023 22:56:28 -0500 Subject: [PATCH 02/99] docs: add screenshot to README.md (#9) --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 0eb34c8..f8018fb 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,18 @@ 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 Actions job summary + +By default, commit-check-action results are shown on the job summary page of the workflow. + +### Success summary + +![Success summary](https://github.com/commit-check/.github/blob/main/screenshot/success-summary.png) + +### Failure summary + +![Failure summary](https://github.com/commit-check/.github/blob/main/screenshot/failure-summary.png) + ## Badging your repository You can add a badge to your repository to show your contributors / users that you use commit-check! From 605095fb41530558f6e2ee7591bfead4c167b27f Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Mon, 6 Feb 2023 18:55:45 -0700 Subject: [PATCH 03/99] refactor: change from summary to job-summary (#10) --- .github/workflows/commit-check.yml | 2 +- LICENSE | 21 --------------------- README.md | 18 +++++++----------- action.yml | 6 +++--- entrypoint => entrypoint.sh | 20 +++++++++----------- 5 files changed, 20 insertions(+), 47 deletions(-) delete mode 100644 LICENSE rename entrypoint => entrypoint.sh (71%) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 3c421da..fad54eb 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -16,4 +16,4 @@ jobs: branch: true author-name: true author-email: true - summary: true + job-summary: true diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 075dbce..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Commit Check - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index f8018fb..c51c662 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ jobs: author-name: true author-email: true dry-run: true - summary: true + job-summary: true ``` ## Optional Inputs @@ -61,24 +61,24 @@ jobs: - **Description**: run checks without failing. exit code is 0 otherwise is 1. - Default: 'false' -### `summary` +### `job-summary` - **Description**: display job summary to a workflow run - Default: 'true' 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 Actions job summary +## GitHub Action job summary By default, commit-check-action results are shown on the job summary page of the workflow. -### Success summary +### Success job summary -![Success 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-summary.png) -### Failure summary +### Failure job summary -![Failure 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-summary.png) ## Badging your repository @@ -108,7 +108,3 @@ Versioning follows [Semantic Versioning](https://semver.org/). ## Have question or feedback? To provide feedback (requesting a feature or reporting a bug) please post to [issues](https://github.com/commit-check/commit-check/issues). - -## License - -[MIT License](LICENSE) diff --git a/action.yml b/action.yml index ef16335..aa58901 100644 --- a/action.yml +++ b/action.yml @@ -25,14 +25,14 @@ inputs: description: run checks without failing required: false default: false - summary: + job-summary: description: add a job summary required: false default: true runs: using: "composite" steps: - - run: ${{ github.action_path }}/entrypoint + - run: ${{ github.action_path }}/entrypoint.sh shell: bash env: MESSAGE: ${{ inputs.message }} @@ -40,4 +40,4 @@ runs: AUTHOR_NAME: ${{ inputs.author-name }} AUTHOR_EMAIL: ${{ inputs.author-email }} DRY_RUN: ${{ inputs.dry-run }} - SUMMARY: ${{ inputs.summary }} + JOB_SUMMARY: ${{ inputs.job-summary }} diff --git a/entrypoint b/entrypoint.sh similarity index 71% rename from entrypoint rename to entrypoint.sh index 697b594..9c5451a 100755 --- a/entrypoint +++ b/entrypoint.sh @@ -2,7 +2,7 @@ ret_code=0 -install_deps(){ +install_dependencies(){ if [ "$RUNNER_OS" == "Linux" ]; then # https://github.com/pypa/setuptools/issues/3269 export DEB_PYTHON_INSTALL_LAYOUT=deb @@ -26,12 +26,12 @@ run_commit_check(){ fi echo "commit-check $args" - commit-check $args > result.txt + commit-check "$args" > result.txt ret_code=$? } add_job_summary(){ - if [ "$SUMMARY" == "false" ]; then + if [ "$JOB_SUMMARY" == "false" ]; then exit fi @@ -39,19 +39,18 @@ add_job_summary(){ # strips ANSI colors sed -i "s,\x1B\[[0-9;]*[a-zA-Z],,g" result.txt cat result.txt - echo "### Commit-Check ❌" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - cat result.txt >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY + echo "### Commit-Check ❌" >> "$GITHUB_STEP_SUMMARY" + echo '```' >> "$GITHUB_STEP_SUMMARY" + cat result.txt >> "$GITHUB_STEP_SUMMARY" + echo '```' >> "$GITHUB_STEP_SUMMARY" ret_code=1 else - echo "### Commit-Check ✔️" >> $GITHUB_STEP_SUMMARY + echo "### Commit-Check ✔️" >> "$GITHUB_STEP_SUMMARY" ret_code=0 fi } -# start of main -install_deps +install_dependencies run_commit_check add_job_summary @@ -60,4 +59,3 @@ if [ "$DRY_RUN" == "true" ]; then fi exit $ret_code -# end of main From 6f2eddc95d814524aac2d0c4dbefa303ba3628e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Feb 2023 17:47:55 -0700 Subject: [PATCH 04/99] chore(deps): bump commit-check from 0.4.2 to 0.5.1 (#11) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.4.2 to 0.5.1. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.4.2...v0.5.1) --- 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 47b7663..630d34a 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.4.2 +commit-check==0.5.1 From 65ac4d36d74351d70cac30207f6d1a6d6662146d Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Tue, 14 Feb 2023 21:03:21 -0700 Subject: [PATCH 05/99] docs: create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..149b4e3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 shenxianpeng (xianpeng.shen@gmail.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From eb68373ba0017a86f49f2873394074c71aa341b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 25 Feb 2023 08:46:18 +0800 Subject: [PATCH 06/99] chore(deps): bump commit-check from 0.5.1 to 0.5.3 (#13) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.5.1 to 0.5.3. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.5.1...v0.5.3) --- 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 630d34a..f31d6bd 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.5.1 +commit-check==0.5.3 From 6390e2c7feadce56d32285bebdce74c368aba4bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Apr 2023 23:01:17 -0600 Subject: [PATCH 07/99] chore(deps): bump commit-check from 0.5.3 to 0.5.4 (#16) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.5.3 to 0.5.4. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.5.3...v0.5.4) --- 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 f31d6bd..4c67149 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.5.3 +commit-check==0.5.4 From 30564fef2353058785b6503a81753005e18b2326 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Fri, 7 Apr 2023 21:06:05 +0800 Subject: [PATCH 08/99] fix: unrecognized arguments (#17) --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9c5451a..98703ea 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -26,7 +26,7 @@ run_commit_check(){ fi echo "commit-check $args" - commit-check "$args" > result.txt + commit-check $args > result.txt ret_code=$? } From a7d7e72c49d7a85305ed160f175e09502e2ba87e Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 7 Apr 2023 13:09:43 +0000 Subject: [PATCH 09/99] chore: add workflow_dispatch event --- .github/workflows/commit-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index fad54eb..700425f 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -4,6 +4,7 @@ on: push: pull_request: branches: 'main' + workflow_dispatch: jobs: commit-check: From b5f0514495376efbdd266ece7c2cf0d7cde1ebbd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Apr 2023 04:02:36 -0600 Subject: [PATCH 10/99] chore(deps): bump commit-check from 0.5.4 to 0.5.6 (#19) * chore(deps): bump commit-check from 0.5.4 to 0.5.6 Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.5.4 to 0.5.6. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.5.4...v0.5.6) --- updated-dependencies: - dependency-name: commit-check dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * chore: support branch start with dependabot --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: shenxianpeng --- .commit-check.yml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.commit-check.yml b/.commit-check.yml index 008e02e..bfabe35 100644 --- a/.commit-check.yml +++ b/.commit-check.yml @@ -10,7 +10,7 @@ checks: suggest: git commit --amend --no-verify - check: branch - regex: ^(bugfix|feature|release|hotfix|task)\/.+|(master)|(main)|(HEAD)|(PR-.+) + 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 diff --git a/requirements.txt b/requirements.txt index 4c67149..be65bd7 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.5.4 +commit-check==0.5.6 From 183ae196ba3423f4801fc7cac5d48fae62c969c1 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Fri, 14 Apr 2023 08:25:09 -0600 Subject: [PATCH 11/99] refactor: Update entrypoint.sh (#20) --- entrypoint.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 98703ea..3e365c7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,10 @@ #!/bin/bash +set -euo pipefail ret_code=0 install_dependencies(){ - if [ "$RUNNER_OS" == "Linux" ]; then + if [[ "$RUNNER_OS" == "Linux" ]]; then # https://github.com/pypa/setuptools/issues/3269 export DEB_PYTHON_INSTALL_LAYOUT=deb fi @@ -12,16 +13,13 @@ install_dependencies(){ run_commit_check(){ args="" - if [ "$MESSAGE" == "true" ]; then + if [[ "$MESSAGE" == "true" ]]; then args="$args --message" - fi - if [ "$BRANCH" == "true" ]; then + elif [[ "$BRANCH" == "true" ]]; then args="$args --branch" - fi - if [ "$AUTHOR_NAME" == "true" ]; then + elif [[ "$AUTHOR_NAME" == "true" ]]; then args="$args --author-name" - fi - if [ "$AUTHOR_EMAIL" == "true" ]; then + elif [[ "$AUTHOR_EMAIL" == "true" ]]; then args="$args --author-email" fi @@ -31,7 +29,7 @@ run_commit_check(){ } add_job_summary(){ - if [ "$JOB_SUMMARY" == "false" ]; then + if [[ "$JOB_SUMMARY" == "false" ]]; then exit fi @@ -54,7 +52,7 @@ install_dependencies run_commit_check add_job_summary -if [ "$DRY_RUN" == "true" ]; then +if [[ "$DRY_RUN" == "true" ]]; then ret_code=0 fi From b18b48afc821b905890f1e006c6e096df7048f18 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Wed, 19 Apr 2023 12:15:06 +0800 Subject: [PATCH 12/99] feat: create CODEOWNERS file --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..4f08a45 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @shenxianpeng From 3d602860a8e08c39800a80ea59e1470473c8dd3c Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 4 May 2023 11:57:56 +0800 Subject: [PATCH 13/99] chore: Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c51c662..3512e9c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Commit-Check GitHub Action +[![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) [![GitHub marketplace](https://img.shields.io/badge/Marketplace-commit--check--action-blue)](https://github.com/marketplace/actions/commit-check-action) From e8c0354cb5b4da1dc1f062e38999a320891c6235 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 23:20:25 -0400 Subject: [PATCH 14/99] chore(deps): bump actions/checkout from 3 to 4 (#21) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout 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/commit-check.yml | 2 +- .github/workflows/main.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 700425f..bb45d9e 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -10,7 +10,7 @@ jobs: commit-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: commit-check/commit-check-action@v1 with: message: true diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3076451..913593d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -19,7 +19,7 @@ jobs: re-tag: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ inputs.ref }} From a8a4d8a4e5fa8fc276db91abafcf168f4f2b90a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Nov 2023 09:50:42 +0800 Subject: [PATCH 15/99] chore(deps): bump commit-check from 0.5.6 to 0.6.2 (#22) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.5.6 to 0.6.2. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.5.6...v0.6.2) --- 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 be65bd7..2267a0d 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.5.6 +commit-check==0.6.2 From a00832b3a9a0df00c17a32258ecbb064db17e846 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Sun, 19 Nov 2023 08:43:35 -0500 Subject: [PATCH 16/99] fix: update action.yml and entrypoint.sh to fix #23 (#25) --- action.yml | 9 +++++++++ entrypoint.sh | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index aa58901..cf0b61f 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,15 @@ inputs: runs: using: "composite" steps: + - name: Install action dependencies + shell: bash + run: | + if [[ "$RUNNER_OS" == "Linux" ]]; then + # https://github.com/pypa/setuptools/issues/3269 + export DEB_PYTHON_INSTALL_LAYOUT=deb + fi + python3 -m pip install -r "$GITHUB_ACTION_PATH/requirements.txt" + - name: Run commit-check - run: ${{ github.action_path }}/entrypoint.sh shell: bash env: diff --git a/entrypoint.sh b/entrypoint.sh index 3e365c7..5389097 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,14 +3,6 @@ set -euo pipefail ret_code=0 -install_dependencies(){ - if [[ "$RUNNER_OS" == "Linux" ]]; then - # https://github.com/pypa/setuptools/issues/3269 - export DEB_PYTHON_INSTALL_LAYOUT=deb - fi - python3 -m pip install -r requirements.txt -} - run_commit_check(){ args="" if [[ "$MESSAGE" == "true" ]]; then @@ -48,7 +40,6 @@ add_job_summary(){ fi } -install_dependencies run_commit_check add_job_summary From c67a8441e491fb7500ccae8be352ec5d6680c47a Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Sun, 19 Nov 2023 21:48:16 +0800 Subject: [PATCH 17/99] fix: Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index cf0b61f..4edf280 100644 --- a/action.yml +++ b/action.yml @@ -41,8 +41,8 @@ runs: fi python3 -m pip install -r "$GITHUB_ACTION_PATH/requirements.txt" - name: Run commit-check - - run: ${{ github.action_path }}/entrypoint.sh shell: bash + run: ${{ github.action_path }}/entrypoint.sh env: MESSAGE: ${{ inputs.message }} BRANCH: ${{ inputs.branch }} From 89635055a8f5224aff43c167caa8cd86ac13b175 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Sun, 19 Nov 2023 09:20:50 -0500 Subject: [PATCH 18/99] fix: Update entrypoint.sh (#26) --- entrypoint.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 5389097..d3dda19 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,11 +7,14 @@ run_commit_check(){ args="" if [[ "$MESSAGE" == "true" ]]; then args="$args --message" - elif [[ "$BRANCH" == "true" ]]; then + fi + if [[ "$BRANCH" == "true" ]]; then args="$args --branch" - elif [[ "$AUTHOR_NAME" == "true" ]]; then + fi + if [[ "$AUTHOR_NAME" == "true" ]]; then args="$args --author-name" - elif [[ "$AUTHOR_EMAIL" == "true" ]]; then + fi + if [[ "$AUTHOR_EMAIL" == "true" ]]; then args="$args --author-email" fi From 2f6a5c15c569aba3a10fe0ac280e81b9cbf7d181 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:19:32 +0800 Subject: [PATCH 19/99] chore(deps): bump commit-check from 0.6.2 to 0.6.3 (#27) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.6.2 to 0.6.3. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.6.2...v0.6.3) --- 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 2267a0d..fe4abfc 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.6.2 +commit-check==0.6.3 From 8bd1a407910f85181ffccd57c094f603f549eb90 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 27 Dec 2023 14:37:10 +0800 Subject: [PATCH 20/99] feat: add release.yml --- .github/release.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..d1eca56 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,25 @@ +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options + +changelog: + exclude: + labels: + - ignore-for-release + categories: + - title: '🔥 Breaking Changes' + labels: + - 'breaking' + - title: 🏕 Features + labels: + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'bug' + - title: '👋 Deprecated' + labels: + - 'deprecation' + - title: 👒 Dependencies + labels: + - dependencies + - title: Other Changes + labels: + - "*" From 3826c351c343a347f74ce4ab09b2c359dceb3f9c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Dec 2023 14:38:38 +0800 Subject: [PATCH 21/99] chore(deps): bump commit-check from 0.6.3 to 0.7.0 (#28) * chore(deps): bump commit-check from 0.6.3 to 0.7.0 Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.6.3 to 0.7.0. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.6.3...v0.7.0) --- updated-dependencies: - dependency-name: commit-check dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * feat: support checking committer signature * feat: support checking committer signature --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: shenxianpeng --- README.md | 9 +++++++-- action.yml | 5 +++++ entrypoint.sh | 3 +++ requirements.txt | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3512e9c..ae0507a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action) [![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, and more. +A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more. ## Usage @@ -39,7 +39,7 @@ jobs: ### `message` - **Description**: check commit message formatting convention. - - By default the rule follows [conventionalcommits](https://www.conventionalcommits.org/). + - By default the rule follows [conventional commits](https://www.conventionalcommits.org/). - Default: 'true' ### `branch` @@ -58,6 +58,11 @@ jobs: - **Description**: check committer author email - Default: 'true' +### `commit-signoff` + +- **Description**: check committer commit signature +- Default: 'true' + ### `dry-run` - **Description**: run checks without failing. exit code is 0 otherwise is 1. diff --git a/action.yml b/action.yml index 4edf280..4d02a9c 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,10 @@ inputs: description: check committer author email required: false default: true + commit-signoff: + description: check committer commit signature + required: false + default: true dry-run: description: run checks without failing required: false @@ -48,5 +52,6 @@ runs: BRANCH: ${{ inputs.branch }} AUTHOR_NAME: ${{ inputs.author-name }} AUTHOR_EMAIL: ${{ inputs.author-email }} + COMMIT_SIGNOFF: ${{ inputs.commit-signoff }} DRY_RUN: ${{ inputs.dry-run }} JOB_SUMMARY: ${{ inputs.job-summary }} diff --git a/entrypoint.sh b/entrypoint.sh index d3dda19..0523cae 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,6 +17,9 @@ run_commit_check(){ if [[ "$AUTHOR_EMAIL" == "true" ]]; then args="$args --author-email" fi + if [[ "$COMMIT_SIGNOFF" == "true" ]]; then + args="$args --commit-signoff" + fi echo "commit-check $args" commit-check $args > result.txt diff --git a/requirements.txt b/requirements.txt index fe4abfc..26a8eed 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.6.3 +commit-check==0.7.0 From 3455135498bc779cef62a0e7eee1e7b7b9cadd19 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 27 Dec 2023 14:44:33 +0800 Subject: [PATCH 22/99] docs: update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ae0507a..771b611 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ jobs: branch: true author-name: true author-email: true + commit-signoff: true dry-run: true job-summary: true ``` From 0454b6019fd8b0e7e3f53297534d054706ee2f1e Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 27 Dec 2023 14:45:28 +0800 Subject: [PATCH 23/99] docs: update README.md Signed-off-by: shenxianpeng --- .github/workflows/commit-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index bb45d9e..408838c 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -17,4 +17,5 @@ jobs: branch: true author-name: true author-email: true + commit-signoff: true job-summary: true From a0c741bdfac19d016432f0ad9da03aa236dd8f54 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Fri, 29 Dec 2023 14:00:25 +0800 Subject: [PATCH 24/99] chore: Update release.yml --- .github/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release.yml b/.github/release.yml index d1eca56..d82f279 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -17,7 +17,7 @@ changelog: - title: '👋 Deprecated' labels: - 'deprecation' - - title: 👒 Dependencies + - title: 📦 Dependencies labels: - dependencies - title: Other Changes From 35fcd30cbaa6258c9a403118171b5cb658ceeec6 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Fri, 29 Dec 2023 00:16:10 -0700 Subject: [PATCH 25/99] feat: move release.yml to central repository(#29) --- .github/release.yml | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index d82f279..0d0b1c9 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,25 +1 @@ -# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options - -changelog: - exclude: - labels: - - ignore-for-release - categories: - - title: '🔥 Breaking Changes' - labels: - - 'breaking' - - title: 🏕 Features - labels: - - 'enhancement' - - title: '🐛 Bug Fixes' - labels: - - 'bug' - - title: '👋 Deprecated' - labels: - - 'deprecation' - - title: 📦 Dependencies - labels: - - dependencies - - title: Other Changes - labels: - - "*" +_extends: .github From 4dcb2d3f30e8d16b4029f852635ce9d628c897e0 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Fri, 29 Dec 2023 00:19:21 -0700 Subject: [PATCH 26/99] feat: move release.yml to back to repo This reverts commit 35fcd30cbaa6258c9a403118171b5cb658ceeec6. --- .github/release.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/release.yml b/.github/release.yml index 0d0b1c9..d82f279 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1 +1,25 @@ -_extends: .github +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options + +changelog: + exclude: + labels: + - ignore-for-release + categories: + - title: '🔥 Breaking Changes' + labels: + - 'breaking' + - title: 🏕 Features + labels: + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'bug' + - title: '👋 Deprecated' + labels: + - 'deprecation' + - title: 📦 Dependencies + labels: + - dependencies + - title: Other Changes + labels: + - "*" From 4b4a3c7b00cfff9cef4075cef2a1f3fc0ce0397c Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Mon, 15 Jan 2024 22:57:37 -0700 Subject: [PATCH 27/99] feat: Create release-drafter.yml (#32) --- .github/release-drafter.yml | 1 + .github/workflows/release-drafter.yml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..0d0b1c9 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1 @@ +_extends: .github diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..d703049 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,16 @@ +name: Release Drafter + +on: + push: + branches: + - "main" + 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@v5 + env: + GITHUB_TOKEN: ${{ secrets.COMMIT_CHECK_TOKEN }} From a1bb76326b8382733211d8efd563739a7a95ce09 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Mon, 15 Jan 2024 23:03:20 -0700 Subject: [PATCH 28/99] chore: remove release.yml (#33) * feat: Create release-drafter.yml * chore: remove release.yml --- .github/release.yml | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml deleted file mode 100644 index d82f279..0000000 --- a/.github/release.yml +++ /dev/null @@ -1,25 +0,0 @@ -# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options - -changelog: - exclude: - labels: - - ignore-for-release - categories: - - title: '🔥 Breaking Changes' - labels: - - 'breaking' - - title: 🏕 Features - labels: - - 'enhancement' - - title: '🐛 Bug Fixes' - labels: - - 'bug' - - title: '👋 Deprecated' - labels: - - 'deprecation' - - title: 📦 Dependencies - labels: - - dependencies - - title: Other Changes - labels: - - "*" From 4f8e615f72af6adc3ba07d77284849c5acbc3523 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 12:07:45 +0800 Subject: [PATCH 29/99] chore(deps): bump commit-check from 0.7.0 to 0.7.1 (#34) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.7.0 to 0.7.1. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.7.0...v0.7.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 26a8eed..736ca64 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.0 +commit-check==0.7.1 From a4909678d539481564cc7cda60c3986aee68968e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:10:23 +0800 Subject: [PATCH 30/99] chore(deps): bump release-drafter/release-drafter from 5 to 6 (#35) Bumps [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) from 5 to 6. - [Release notes](https://github.com/release-drafter/release-drafter/releases) - [Commits](https://github.com/release-drafter/release-drafter/compare/v5...v6) --- updated-dependencies: - dependency-name: release-drafter/release-drafter 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/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index d703049..1d51417 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -11,6 +11,6 @@ jobs: runs-on: ubuntu-latest steps: # Drafts your next Release notes as Pull Requests are merged into the default branch - - uses: release-drafter/release-drafter@v5 + - uses: release-drafter/release-drafter@v6 env: GITHUB_TOKEN: ${{ secrets.COMMIT_CHECK_TOKEN }} From a9a07be74ea6f1f34f4681c346077769368269c7 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Sun, 10 Mar 2024 15:49:05 +0800 Subject: [PATCH 31/99] chore: change release-drafter token to GITHUB_TOKEN --- .github/workflows/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 1d51417..1d03058 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -13,4 +13,4 @@ jobs: # Drafts your next Release notes as Pull Requests are merged into the default branch - uses: release-drafter/release-drafter@v6 env: - GITHUB_TOKEN: ${{ secrets.COMMIT_CHECK_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOEKEN }} From 1e395609f0768727b14ec2cae251bb01ccf79acc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 10 Mar 2024 15:55:52 +0800 Subject: [PATCH 32/99] chore(deps): bump commit-check from 0.7.1 to 0.7.2 (#36) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.7.1 to 0.7.2. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.7.1...v0.7.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 736ca64..bb6327c 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.1 +commit-check==0.7.2 From 8ddedda5aa14bbf98426cbbb4b5f38dbe071d000 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Sun, 10 Mar 2024 15:58:30 +0800 Subject: [PATCH 33/99] fix: update release-drafter.yml to fix typo --- .github/workflows/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 1d03058..c6536f9 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -13,4 +13,4 @@ jobs: # 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_TOEKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e055f1418b24f9038c92c8965980b65df9300a75 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Mon, 11 Mar 2024 11:25:54 +0800 Subject: [PATCH 34/99] chore: update checkout version to v4 #37 (#38) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 771b611..54937dd 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ jobs: commit-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: commit-check/commit-check-action@v1 with: message: true From f35ff3503e7ca754a519c02e9b3ef86a0658eccf Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Mon, 11 Mar 2024 15:04:21 +0800 Subject: [PATCH 35/99] feat: add main.py and remove entrypoint.sh (#41) --- action.yml | 2 +- entrypoint.sh | 56 ---------------------------------------------- main.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 57 deletions(-) delete mode 100755 entrypoint.sh create mode 100755 main.py diff --git a/action.yml b/action.yml index 4d02a9c..7a1823d 100644 --- a/action.yml +++ b/action.yml @@ -46,7 +46,7 @@ runs: python3 -m pip install -r "$GITHUB_ACTION_PATH/requirements.txt" - name: Run commit-check shell: bash - run: ${{ github.action_path }}/entrypoint.sh + run: python3 ${{ github.action_path }}/main.py env: MESSAGE: ${{ inputs.message }} BRANCH: ${{ inputs.branch }} diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100755 index 0523cae..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -set -euo pipefail - -ret_code=0 - -run_commit_check(){ - args="" - if [[ "$MESSAGE" == "true" ]]; then - args="$args --message" - fi - if [[ "$BRANCH" == "true" ]]; then - args="$args --branch" - fi - if [[ "$AUTHOR_NAME" == "true" ]]; then - args="$args --author-name" - fi - if [[ "$AUTHOR_EMAIL" == "true" ]]; then - args="$args --author-email" - fi - if [[ "$COMMIT_SIGNOFF" == "true" ]]; then - args="$args --commit-signoff" - fi - - echo "commit-check $args" - commit-check $args > result.txt - ret_code=$? -} - -add_job_summary(){ - if [[ "$JOB_SUMMARY" == "false" ]]; then - exit - fi - - if [ -s result.txt ]; then - # strips ANSI colors - sed -i "s,\x1B\[[0-9;]*[a-zA-Z],,g" result.txt - cat result.txt - echo "### Commit-Check ❌" >> "$GITHUB_STEP_SUMMARY" - echo '```' >> "$GITHUB_STEP_SUMMARY" - cat result.txt >> "$GITHUB_STEP_SUMMARY" - echo '```' >> "$GITHUB_STEP_SUMMARY" - ret_code=1 - else - echo "### Commit-Check ✔️" >> "$GITHUB_STEP_SUMMARY" - ret_code=0 - fi -} - -run_commit_check -add_job_summary - -if [[ "$DRY_RUN" == "true" ]]; then - ret_code=0 -fi - -exit $ret_code diff --git a/main.py b/main.py new file mode 100755 index 0000000..2b07aec --- /dev/null +++ b/main.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import os +import sys +import subprocess +import re + + +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"] + + 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) + return result.returncode + + +def add_job_summary() -> int: + if JOB_SUMMARY == "false": + sys.exit() + + 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 + + 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") + return 0 + + +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"] + +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") + +ret_code = run_commit_check() +ret_code += add_job_summary() # Combine return codes + +if DRY_RUN == "true": + ret_code = 0 + +sys.exit(ret_code) From b3c25e1a061942364d75bc9604ccf480132185cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 08:08:51 +0800 Subject: [PATCH 36/99] chore(deps): bump commit-check from 0.7.2 to 0.7.3 (#42) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.7.2 to 0.7.3. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.7.2...v0.7.3) --- 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 bb6327c..5c0c2fb 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.2 +commit-check==0.7.3 From b5d2b007142cc40d5df513d0aea8f60da52c09e0 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Wed, 27 Mar 2024 11:17:23 +0800 Subject: [PATCH 37/99] feat: self test by adding ./ (#43) --- .github/workflows/commit-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 408838c..9689bb3 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: commit-check/commit-check-action@v1 + - uses: ./ # self test with: message: true branch: true From 4e3acb738a7f359874cb53ba33ba3f4ea6002c39 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Wed, 27 Mar 2024 13:17:03 +0800 Subject: [PATCH 38/99] feat: add used-by badge and workflow (#44) --- .github/workflows/used-by.yml | 27 +++++++++++++++++++++++++++ .gitignore | 1 + README.md | 1 + 3 files changed, 29 insertions(+) create mode 100644 .github/workflows/used-by.yml create mode 100644 .gitignore diff --git a/.github/workflows/used-by.yml b/.github/workflows/used-by.yml new file mode 100644 index 0000000..ea70dc8 --- /dev/null +++ b/.github/workflows/used-by.yml @@ -0,0 +1,27 @@ +name: Used By + +on: + schedule: + # https://crontab.guru/ + - cron: '0 9 * * 1' # At 09:00 on Monday. + workflow_dispatch: + +jobs: + used-by: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: shenxianpeng/used-by@v0.1.2 + with: + repo: '${{ github.repository }}' + update-badge: 'true' + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + add-paths: "README.md" # the file path to commit + commit-message: "chore: update used-by badge by github-actions[bot]" + title: "chore: automatically update used-by badge" + base: main + labels: skip-changelog + delete-branch: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7275bb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv/ diff --git a/README.md b/README.md index 54937dd..b655631 100644 --- a/README.md +++ b/README.md @@ -3,6 +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) [![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 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 39/99] 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 40/99] 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 41/99] 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 42/99] 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 43/99] 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 44/99] 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 45/99] 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 46/99] 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 47/99] 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 48/99] 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 49/99] 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 50/99] 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 51/99] 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 52/99] 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 53/99] 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 54/99] 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 55/99] 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 56/99] 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 57/99] 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 58/99] 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 59/99] 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 60/99] 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 61/99] 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 62/99] 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 63/99] 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 64/99] 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 65/99] 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 66/99] 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 67/99] 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 68/99] 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 69/99] 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 70/99] 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 71/99] 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 72/99] 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 73/99] 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 74/99] 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 75/99] 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 76/99] 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 77/99] 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 78/99] 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 79/99] 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 80/99] 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 81/99] 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 82/99] 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 83/99] 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 84/99] 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 85/99] 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 86/99] 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 87/99] 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 88/99] 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 89/99] 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 90/99] 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 91/99] 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 92/99] 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 93/99] 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 94/99] 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 95/99] 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. From 2a2720988b5dc4de387a87aa095bcd36d5477ff5 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 9 May 2025 14:02:52 +0300 Subject: [PATCH 96/99] docs: Update README.md to add more user (#110) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b1581f8..c402e4c 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ jobs: OpenCADC   Extrawest Extrawest + Chainlift + Chainlift   and many more.

From 6fc6f138e6cf9839ffdfd9b644e9c6ff16d18ca7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 20:42:24 +0300 Subject: [PATCH 97/99] chore: update used-by badge by github-actions[bot] (#111) 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 c402e4c..8c3955f 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=62&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=64&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 1e0b8f60abf130034231a303f520213c7da90421 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 01:05:57 +0300 Subject: [PATCH 98/99] chore(deps): bump commit-check from 0.9.5 to 0.9.6 (#112) Bumps [commit-check](https://github.com/commit-check/commit-check) from 0.9.5 to 0.9.6. - [Release notes](https://github.com/commit-check/commit-check/releases) - [Commits](https://github.com/commit-check/commit-check/compare/v0.9.5...v0.9.6) --- updated-dependencies: - dependency-name: commit-check dependency-version: 0.9.6 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 764bb33..e16e5b7 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.5 +commit-check==0.9.6 # Interact with the GitHub API. PyGithub==2.6.1 From f09ba795622b9cb0d0d5e668926235a1d893c7a4 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Mon, 2 Jun 2025 01:15:48 +0300 Subject: [PATCH 99/99] docs: update README.md to add SLSA badge (#108) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8c3955f..864c2a9 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ![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=64&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) +[![slsa-badge](https://slsa.dev/images/gh-badge-level3.svg)](https://github.com/commit-check/commit-check-action/blob/a2873ca0482dd505c93fb51861c953e82fd0a186/action.yml#L59-L69) A Github Action for checking commit message formatting, branch naming, committer name, email, commit signoff and more.