2on: [ push, pull_request ]
5 check-commit-msg-length:
8 - uses: actions/checkout@v1
9 - name: Check commit message length
11 # Get last commit messages
12 if [ "${{github.event_name}}" = "push" ]; then
13 if [ "${{github.event.before}}" = "0000000000000000000000000000000000000000" ]; then
14 # We are on a new branch
15 current="$(echo '${{github.ref}}' | sed 's!^refs/heads!origin!')"
16 readarray -t other < <(git show-ref | awk -F' ' '{ sub(/^refs\/remotes\//,"",$NF); }($NF != "'"$current"'"){print "^" $NF;}')
17 LOG_RANGE=( "$current" "${other[@]}" )
20 # We are on existing branch
21 LOG_RANGE=( "${{github.event.before}}.." )
23 elif [ "${{github.event_name}}" = "pull_request" ]; then
24 LOG_RANGE=( "origin/${{github.base_ref}}.." )
26 if [[ -v LOG_RANGE ]]; then
27 if git log --no-merges --pretty=format:"%s" "${LOG_RANGE[@]}" -- | grep -qE "^[^#].{78}"; then
28 echo -e "Last commit log contains a line with more than 78 characters:\n"
29 git log --no-merges --pretty=format:"%h: %s" "${LOG_RANGE[@]}" -- | grep -E "^[^:]+: [^#].{78}"
33 echo "Commit log looks good."
37 echo "Not checking commits on ${{github.event_name}}"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list