Skip to content

Commit

Permalink
feat(dependabot): fix dependabot detection and add special commit lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kramen22 committed Nov 22, 2023
1 parent b6238f7 commit db37c71
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .commitlintrc.dependabot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: [
'@commitlint/config-conventional',
],
rules: {
'body-max-line-length': [1, 'always', 150],
},
};
23 changes: 23 additions & 0 deletions .github/workflows/commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,32 @@ jobs:
run: |
npm install @commitlint/config-conventional @commitlint/cli
- name: Check for Dependabot
run: |
BASE=${{ github.event.pull_request.base.sha }}
HEAD=${{ github.event.pull_request.head.sha }}
DEPENDABOTS=$(
git log \
--oneline \
--author="dependabot\[bot\]*" \
--ancestry-path \
"${BASE}..${HEAD}" |
wc -l
)
echo "FM_DEPENDABOTS=${DEPENDABOTS}" >> $GITHUB_ENV
- if: ${{ env.FM_DEPENDABOTS > 0 }}
name: Set Dependabot Config
run: echo 'COMMITLINT_RC=.commitlintrc.dependabot.js' >> $GITHUB_ENV

- if: ${{ env.FM_DEPENDABOTS < 1 }}
name: Set Config
run: echo 'COMMITLINT_RC=.commitlintrc.js' >> $GITHUB_ENV

- name: Conventional commit check
run: |
npx commitlint \
--config '${{ env.COMMITLINT_RC }}' \
--from ${{ github.event.pull_request.base.sha }} \
--to ${{ github.event.pull_request.head.sha }}
Expand Down

0 comments on commit db37c71

Please sign in to comment.