Git Product home page Git Product logo

commit-message-checker's People

Contributors

dependabot[bot] avatar eliashaeussler avatar gilbertsoft avatar italoyeltsin avatar nasuku avatar teszes avatar tiboris avatar veysiertekin avatar vijishankar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

commit-message-checker's Issues

Action doesn't work if one PR contains more commits

Thanks to the author, we can use this action to check commit message following the proper format.

But I found the action failed to check following situations:
(1) the PR contains 2 or more commits;
(2) at least one commit in the PR following the proper format;
(3) at least one commit in the PR broken the rule of proper format.
In this case, the check still treat the situation as proper one then check pass. but in the controversary, the action check shall be failed due to "at least one commit broken the rule of format".

Can you let me know, how to enable the action to check on every commit of one PR. Or, is it possible to improve in next version?

Add an option to invert the check (fail if RegExp succeeds)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Are you willing to sponsor your idea?

  • Yes, I like to sponsor this request

Is your feature request related to a problem? Please describe

I am trying to fail if a commit message starts with fixup or squash. I am also trying to fail if a message contains [no-merge]. It is far easier to check for the existence of these things than confirm the negative.

Describe the solution you'd like

A new flag: failOnMatch. It defaults to false (current behavior). Setting to true will fail if the pattern matches on a commit.

Describe alternatives you've considered

RegExp negative lookahead. Ugh. Not easy to understand for the next person to look at the code. (AKA me, in five minutes.)

Additional context

No response

Checks fails after merging pull request

Hi,
Is there any way to disable checking title after merging a pull request?

Here is my WIP workflow:

name: 'Commit Message Check'
on: [push]
#  pull_request:
#    types:
#      - opened
#      - edited
#      - reopened
#      - synchronize
#  push:
#    branches:
#      - main
#      - 'releases/*'

jobs:
  check-commit-message:
    name: Check Commit Message
    runs-on: ubuntu-latest
    steps:
      - name: Check Commit Type
        uses: gsactions/commit-message-checker@v1
        with:
          pattern: '^(add|remove|fix|chore)\([^\{\}\[\]\(\)]+?\) : '
          flags: 'gm'
          error: 'Your first line has to contain a commit type like "add|remove|fix|chore(...) : ".'
      - name: Check Line Length
        uses: gsactions/commit-message-checker@v1
        with:
          pattern: '^[^#].{74}'
          error: 'The maximum line length of 74 characters is exceeded.'
          excludeDescription: 'true' # optional: this excludes the description body of a pull request
          excludeTitle: 'true' # optional: this excludes the title of a pull request
          #checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
          #accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
      - name: Check for Resolves / Fixes
        uses: gsactions/commit-message-checker@v1
        with:
          pattern: '^(Closes|Fixes) : \#((?!([A-Z0-9a-z]{1,10})-?$)[A-Z]{1}[A-Z0-9]+-[1-9][0-9]*).+$'
          error: 'You need at least one "Closes|Fixes : #<Jira issue key>" line.' 

Successful Commit check:
Screenshot 2020-11-13 at 09 03 48

Failed checks after merging.
Screenshot 2020-11-13 at 09 04 27
Screenshot 2020-11-13 at 09 04 41

Thanks.

Ignore Github UI commits

Is it possible to ignore Github UI commits? For example, something like Merge branch 'master' into codestyle/#113-check-commits

Error: No commits found in the payload

I am using this action in my workflow:

name: 'Commit Message Check'
on: [push]

jobs:
  check-commit-message:
    name: Check Commit Message
    runs-on: ubuntu-latest
    steps:

      - name: Check Commit Type
        uses: gsactions/commit-message-checker@v1
        with:
          pattern: '^[\(\)\-a-z0-9,\s]+: .+(?:\n(?:\n.+)+)?(?:\n\n.+)?$'
          error: 'Your message must have the correct format "<scope>: <subject>" with an optional body and footer separated by blank lines.'

And it is falling with this msg:

##[error]Error: No commits found in the payload.
##[error]No commits found in the payload.

Here is the commit: shellhub-io/shellhub@2a40e96

My guess is something related to this msg: "This commit does not belong to any branch on this repository", but based on error msg it is something else.

Commit ammedment is not working

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

GitHub-hosted runner

ubuntu-latest

Additional runner information

No response

Current Behavior

After github action failed as it didnot find the regex in the commit message . but it still failed when commit message are rewrited and pushed.

Expected Behavior

It should pass if the commit message is updated as per the regex

Steps To Reproduce

I have put regex like below

      - name: Check Jira ID or Skip tag
        uses: gsactions/commit-message-checker@v1
        with:
          pattern: '(ED-[\d]+|TECH)'
          checkAllCommitMessages: 'true'
          accessToken: ${{ secrets.GITHUB_TOKEN }}
          error: 'You need at least Jira ID or Skip tag i.e [ED-123] | [skip|no issue].'

so to reproduce the problem , you can commit a message without the Jira ID i,e ED-123 , this one will fail which is expected but when you ammend your pushed commit then it should passed.

Anything else?

No response

please create full version release(s)

I have a disdain for the "floating" versions that are supported by actions. Could you create a full release version for this as well?

I've been burnt by using v1 style versions with other 3rd party actions.

Just to be clear, in case you aren't sure what I mean:

v1 is both a version and an alias. It can be aliased to v1.0.0 and when v1.0.1 comes out it aliases to v1.0.1. When v1.1.0 comes out v1 is now an alias to v1.1.0.

I've had issues where an action was promoted from v5.4 to v5.5 and it stops working due to a bug. In this case I was using v5 and suddenly my workflows were failing without any change to them.

While I'm a huge supporter of semver, I also need to have the confidence that things are not changing without my knowledge. I've since required (in my work environment) that we use full versions of actions when possible, and do a round of testing when upgrading actions.

Thank you for your contribution to actions, this one will be helpful to us :D

Event Repository Dispatch is not supported

Hi,
I am trying to run a organizational workflow across multiple repos, trying to enforce work items to be linked to every commit. But i am getting this error

Run gsactions/commit-message-checker@v1
Error: Error: Event "repository_dispatch" is not supported.

Regards

Vaishnav

Use Node16 instead of Node12

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Are you willing to sponsor your idea?

  • Yes, I like to sponsor this request

Is your feature request related to a problem? Please describe

See https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/

Describe the solution you'd like

Update action to use Node 16 instead of Node 12

Describe alternatives you've considered

No response

Additional context

No response

Check for github title prefix doesn't work

I created a wrong commit in order to test the new github action. Then I ammended to the commit and fixed it, I expected the action to become green but it still failed. Then I fixed the PR title and included the "[BUGFIX]" prefix as well, still failing...

This is my config

Run gsactions/commit-message-checker@v1
  with:
    pattern: \[[^]]+\] .+$
    flags: gm
    error: Your first line has to contain a commit type like "[BUGFIX]".
    excludeTitle: false
    excludeDescription: false
    checkAllCommitMessages: false
    accessToken: false

and this is my output:

Checking commit messages against "\[[^]]+\] .+$"...
- failed: "[BUGFIX] Testing commit message github action"
Error: Error: Your first line has to contain a commit type like "[BUGFIX]".

Both, my github title and my commit message have the "[BUGFIX]" prefix and the action still fails.

See my attempts here to play with it FriendsOfTYPO3/extension_builder#453

commit message checker passes when it should fail after pattern is removed from PR commit

Workflow passes despite pattern not being present in the PRs commits.

repro steps:

  1. create multiple commits, have the matching pattern in one of these commits.
  2. open PR, workflow passes as expected.
  3. amend the message to remove the pattern. Now no commits in the PR have the pattern force push. Expect workflow to fail
  4. workflow still passes despite no commits in the PR having a the matching pattern

This is my action definition:

name: Jira Message Check
on:
  pull_request:
    types:
      - opened
      - edited
      - reopened
      - synchronize
  pull_request_target:
    types:
      - opened
      - edited
      - reopened
      - synchronize
jobs:
  check-commit-message:
    name: Check Commit Message
    runs-on: ubuntu-latest
    steps:
      - name: Check Commit Message For Jira Tag
        uses: gsactions/commit-message-checker@v1
        with:
          pattern: 'JIRA: (KAT\-[0-9]+|NOJIRA)$'
          error: 'You need at least one "JIRA: KAT-<issue number>" line below the title line. If there is no jira associated with this PR/commit you may also use JIRA: NOJIRA. Please see docs/contributing/git-style.rst#submitting-changes for examples'
          excludeTitle: 'true'
          excludeDescription: 'true'

Could the previous commit messages be still cached somewhere in the workflow, and end up getting passed to the check-commit-message workflow?

a data point to support this theory: if I add checkAllCommitMessages: 'true' to my workflow, it fails as expected since none of the commits contain the pattern.
If I then switch back to the default checkAllCommitMessages: 'false' it incorrectly passes.

Check duplicity commit messages

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Are you willing to sponsor your idea?

  • Yes, I like to sponsor this request

Is your feature request related to a problem? Please describe

Hi folks,

Thanks for this life-saving tool.

I was thinking that could be really cool to provide some checks for duplicity in the commit messages. This is because sometimes new contributor does not take care of the commit messages when developing and uses the same message for all commits.

Describe the solution you'd like

It would be wonderful to have some input parameters to check duplicity such as:

checkDuplicityMessages: "true"

This will take an input commit list and check duplicity.

Run gsactions/commit-message-checker@v[1](https://github.com/user/repo/actions/runs/3837184384/jobs/6532199)
Checking commit messages duplicity...
- OK: "AB#000000 feat: add commit checker"
- OK: "AB#000000 fix: my message 2"
- OK: "AB#000000 docs: update docs"
- failed: "AB#000000 docs: update docs"
- OK: "AB#000000 fix: my message 3"
Error: Error: You have duplicated commit messages

Describe alternatives you've considered

Maybe using a regex pattern, but I don't know how to apply this

Additional context

No response

Upgrade to node 16

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Are you willing to sponsor your idea?

  • Yes, I like to sponsor this request

Is your feature request related to a problem? Please describe

GitHub actions will deprecate the use of node 12 starting on September 27th,
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/

Describe the solution you'd like

Upgrade to node 16

Describe alternatives you've considered

No response

Additional context

No response

Check only the most recent commit message

I would like to be able to check for a pattern only in the most-recent commit message. Our use case is checking for the result of a test that I want to make sure has passed before a PR can be merged. e.g., Does the commit message contain "Test Successful"?

Some commits in a PR may not contain a test result or may contain an invalid test result, but I only care that the test was run and succeeds as of the latest commit.

I don't want to put the test result in the PR description because a commit made while the PR is open could cause my test to fail, but the GHA check would still pass because of the old message in the PR description.

flag for matching only one commit message

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Are you willing to sponsor your idea?

  • Yes, I like to sponsor this request

Is your feature request related to a problem? Please describe

At the moment each of the commit messages needs to match regex for the action to complete

Describe the solution you'd like

A new flag that would check whether one of the commit messages matches the regex.

Describe alternatives you've considered

No response

Additional context

No response

Original commit message is checked after the Pull Request commit has been updated

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

GitHub-hosted runner

ubuntu-latest

Additional runner information

No response

Current Behavior

I set up a commit-message-checker workflow to check the commit message of a Pull request.
The pattern is to make sure the message begin with certain formatted text.
Then I send a PR with a commit message that doesn't match the pattern, the workflow
detects it and give failure result.
Then I updated the commit's message to something that matches the pattern (locally, run git comment --amend to modify the commit message) and force pushed the commit to repository. The workflow re-triggered automatically. However it still use the old commit message and failed the workflow.

Expected Behavior

I'd expect the workflow could pick up my commit updates and give a successful workflow result.

Steps To Reproduce

  1. Setup a workflow in your repository using this commit-message-checker
  2. send a PR with a commit message that doesn't match the pattern in the workflow.
  3. wait the workflow to fail.
  4. update the commit message using git commit --amend so that the commit message matches the pattern in workflow
  5. force push the commit/branch to the repo
  6. wait for the workflow to be re-triggered and failed again

Anything else?

It would be always check the updated commit message rather than the original one.

Exclude merge commits from checks

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Are you willing to sponsor your idea?

  • Yes, I like to sponsor this request

Is your feature request related to a problem? Please describe

We are trying to automate, checking whether commits match a regex - your action works great.

Unless it's a merge commit (e.g. locally a developer merged one branch into another, created a merge commit and pushed that).

The commit message will not match the desired regex.

Describe the solution you'd like

You can check if a commit is a merge commit:

git cat-file -p $commit_id

If there's more than one `parent' line in the output, you found a merge.

If there's a "ignoreMergeCommits" setting acitvated, then do not even test for the regex (just list it as 'ignored'?)

Describe alternatives you've considered

No response

Additional context

No response

Node16 Actions Runner is deprecated

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Are you willing to sponsor your idea?

  • Yes, I like to sponsor this request

Is your feature request related to a problem? Please describe

Noticed while running CI/CD today that the node16 actions runner was deprecated by GitHub last year.

Describe the solution you'd like

A new version pushed on node20.

Describe alternatives you've considered

We can fork the project to use internally, but would prefer to use the existing solution in the marketplace.

Additional context

No response

regex not matching head commit but rather the PR title

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

GitHub-hosted runner

ubuntu-latest

Additional runner information

      - name: validate commit format -- Check if HEAD commit message contains [xyz] or FAIL.
        uses: gsactions/commit-message-checker@v1
        with:
          pattern: '\[[^]]+\]'
          flags: 'gm'
          error: 'Your  commit must contain `[..]` like "[BUGFIX] or [SDK-974]".'
          #checkAllCommitMessages: 'false' # optional: this checks all commits associated with a pull request
          #accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true

          #pattern: '^[^#].{74}'     error: 'The maximum line length of 74 characters is exceeded.'
          #excludeDescription: 'true' # optional: this excludes the description body of a pull request
          #excludeTitle: 'true' # optional: this excludes the title of a pull request
          #pattern: '^.+(Resolves|Fixes): \#[0-9]+$' #  Check for Resolves / Fixes

Current Behavior

The above mentioned yaml is not working on head commit but rather the PR title. i wish to check on just the head commit and not enforce namings on PR title/ description

Expected Behavior

expected the regex '\[[^]]+\]' to match for commit [FIX] [SDK-974] validate head commit format (should be successful) , but not sure why it isn't matching . on regex101 site, it seems to work correctly. : https://regex101.com/r/VapGyU/1

Steps To Reproduce

run the above yaml mentioned in any github runner and you will find the title getting validated but not the head commit

Anything else?

https://github.com/CleverTap/clevertap-android-sdk/actions/runs/2014762191

[bug] somehow it detects commits that i have since force-pushed myself away from

in my repo i had a bad commit, so i renamed it and force pushed in my PR however the check still fails somehow, and shows the old message. It seems it catches something in the wrong way.

On top of this, if i let this run on my master branch, it will fail on my newest commit because i have a really old commit that doesn't conform the my naming convetion, rather than only checking the commit at hand. should i use another regex flag? (for thsi reason i disabled the check on anything but pull requests)

name: "Commit Message Check"
on:
  pull_request:
    types:
      - opened
      - edited
      - reopened
      - synchronize

jobs:
  check-commit-message:
    name: Check Commit Message
    runs-on: ubuntu-latest
    steps:
      - name: Check Commit Type
        uses: gsactions/commit-message-checker@v1
        with:
          pattern: '(ID-\d+|FIX): .+'
          flags: "gm"
          error: "Naming convention is `[ID]: [summary]` i.e `ID-404: Fixed My Shit`"

`Error: HttpError: Bad credentials` when `checkAllCommitMessages` is `"true"`

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

GitHub-hosted runner

ubuntu-latest

Additional runner information

No response

Current Behavior

When I changed the checkAllCommitMessages to "true", I started getting a Error: HttpError: Bad credentials error.

Step specification:

- name: Check commit message
  uses: GsActions/commit-message-checker@v1
  with:
    checkAllCommitMessages: "true"
    pattern: "^(?!WIP).*$"
    error: "The first line cannot start with WIP"

Job output:

Run GsActions/commit-message-checker@v1
  with:
    checkAllCommitMessages: true
    pattern: ^(?!WIP).*$
    error: The first line cannot start with WIP
    flags: gm
    excludeTitle: false
    excludeDescription: false
    accessToken: false
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.16-1/x6[4](https://github.com/oxidefrp/oxide-kotlin/runs/8246008060?check_suite_focus=true#step:4:4)
  
Error: HttpError: Bad credentials

Expected Behavior

No Error: HttpError: Bad credentials error.

Steps To Reproduce

No response

Anything else?

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.