GsActions / commit-message-checker

GitHub Action that checks commit messages of pushes and pull request against a regex pattern
MIT License
99 stars 56 forks source link

regex not matching head commit but rather the PR title #67

Closed root-ansh-ct closed 2 years ago

root-ansh-ct commented 2 years ago

Code of Conduct

Is there an existing issue for this?

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

gilbertsoft commented 2 years ago

Hey @root-ansh-ct

As long as you don't set checkAllCommitMessages to true only the PR tile and description are used as written here https://github.com/GsActions/commit-message-checker#configuration.

And also check how to debug the action here https://github.com/GsActions/commit-message-checker#troubleshooting-and-debugging.