From ef290751b8cff84a1e2f20ce9a983f339c765bdc Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 29 Oct 2024 10:46:23 +0200 Subject: [PATCH 1/7] 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 2/7] 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 3/7] 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 4/7] 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 5/7] 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 6/7] 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 7/7] 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: