Skip to content

Commit

Permalink
Merge branch 'master' into apple_session_handle
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-hawk committed Mar 30, 2021
2 parents fe0a1dc + 373a288 commit 9a11efc
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/commit-check.yml
@@ -0,0 +1,68 @@
# Please do not attempt to edit this flow without the direct consent from the DevOps team. This file is managed centrally.
# Contact @moabu
name: 'Commit Message Check'
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
pull_request_target:
types:
- opened
- edited
- reopened
- synchronize
push:

jobs:
check-commit-message:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- run: |
npm install --save-dev @commitlint/{config-conventional,cli}
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js
- name: Check Commit Standard
id: conventionalcommit
run: |
git log -1 --pretty=format:"%s" | npx commitlint |& tee -a output.txt
echo "::set-output name=errormsg::$(tr -d "\n\r" < output.txt)"
git log -1 --pretty=format:"%s" | npx commitlint
continue-on-error: true

- name: Check Line Length
id: linelength
uses: gsactions/commit-message-checker@v1
continue-on-error: true
with:
pattern: '^.{1,50}$'
error: 'The maximum line length of 50 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: '^.+(Resolves|Fixes): \#[0-9]+$'
# error: 'You need at least one "Resolves|Fixes: #<issue number>" line.'

- name: Check Commit Standard Status
if: steps.conventionalcommit.outcome != 'success'
run: |
curl -X POST -H 'Content-Type: application/json' --data '{"alias":"Mo-Auto","emoji":":robot:","text":":x: :cry: I am reporting a bad [commit](https://github.com/${{github.repository}}/commit/${{github.sha}}) by :thinking_face: @${{github.actor}} :x:","attachments":[{"title":"GitHub user behavior reporter","title_link":"https://www.conventionalcommits.org","text":"We are not too happy with your last [commit](https://github.com/${{github.repository}}/commit/${{github.sha}}). Here is why : ${{ steps.conventionalcommit.outputs.errormsg }}","color":"#764FA5"}]}' ${{ secrets.GITHUBUSERBEHAVIORROCKETCHATREPORTER }}
exit 1
- name: Check Commit length
if: steps.linelength.outcome != 'success'
run: |
curl -X POST -H 'Content-Type: application/json' --data '{"alias":"Mo-Auto","emoji":":robot:","text":":x: :cry: I am reporting a bad [commit](https://github.com/${{github.repository}}/commit/${{github.sha}}) :thinking_face: by @${{github.actor}} :x:","attachments":[{"title":"GitHub user behavior reporter","title_link":"https://www.conventionalcommits.org","text":"We are not too happy with your last [commit](https://github.com/${{github.repository}}/commit/${{github.sha}}). Limit your commits to <50 chars. Place additional information in the description body of the commit.","color":"#764FA5"}]}' ${{ secrets.GITHUBUSERBEHAVIORROCKETCHATREPORTER }}
echo "The maximum line length of 50 characters is exceeded."
exit 1

0 comments on commit 9a11efc

Please sign in to comment.