ci: push, pull: clarify, robustify? commitlint step

This commit is contained in:
Simon Michael 2022-01-06 06:31:53 -10:00
parent 0a8835ada2
commit 56e015c409
2 changed files with 14 additions and 12 deletions

View File

@ -79,16 +79,18 @@ jobs:
# related: https://stackoverflow.com/questions/64708371/how-to-run-github-workflow-on-every-commit-of-a-push # related: https://stackoverflow.com/questions/64708371/how-to-run-github-workflow-on-every-commit-of-a-push
env: env:
BEFORE: ${{ github.event.before }} BEFORE: ${{ github.event.before }}
NUM: 5 # NUM: 5
shell: bash shell: bash
run: | run: |
RANGE=${BEFORE:-origin/master}..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} RANGE=${BEFORE:-origin/master}..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
git rev-list --quiet $RANGE \ if git rev-list --quiet $RANGE
&& tools/commitlint $RANGE \ then tools/commitlint $RANGE
|| ( echo "could not identify commits, not checking them" ) else echo "could not identify commits, not checking them"
# || ( echo "could not identify commits, checking last $NUM instead:"; tools/commitlint -$NUM ) # echo "could not identify commits, checking last $NUM instead:"
# tools/commitlint -$NUM
fi
- name: Skip remaining CI steps if latest commit message begins with ; - name: Skip remaining steps if last commit message begins with ;
shell: bash shell: bash
run: | run: |
echo "git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} >> $$.gitlog" echo "git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} >> $$.gitlog"

View File

@ -76,16 +76,16 @@ jobs:
# related: https://stackoverflow.com/questions/64708371/how-to-run-github-workflow-on-every-commit-of-a-push # related: https://stackoverflow.com/questions/64708371/how-to-run-github-workflow-on-every-commit-of-a-push
env: env:
BEFORE: ${{ github.event.before }} BEFORE: ${{ github.event.before }}
NUM: 5 # NUM: 5
shell: bash shell: bash
run: | run: |
RANGE=${BEFORE:-origin/master}..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} RANGE=${BEFORE:-origin/master}..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
git rev-list --quiet $RANGE \ if git rev-list --quiet $RANGE
&& tools/commitlint $RANGE \ then tools/commitlint $RANGE
|| ( echo "could not identify commits, not checking them" ) else echo "could not identify commits, not checking them"
# || ( echo "could not identify commits, checking last $NUM instead:"; tools/commitlint -$NUM ) fi
- name: Skip remaining CI steps if latest commit message begins with ; - name: Skip remaining steps if last commit message begins with ;
shell: bash shell: bash
run: | run: |
echo "git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} >> $$.gitlog" echo "git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} >> $$.gitlog"