Skip to content

Commit

Permalink
Fix git pre-commit action failure (#62)
Browse files Browse the repository at this point in the history
* test just commit message

* accurate name

* surround with `"`

* fix mistake

* attempt email from core

* attempt with small brackets

* attempt with `--`

* remove nums

* attempt with husky updates

* update to lockfile

* new attempt

* try with else block

* add shebang

* test with grep pattern matching

* dummy git adds

* update dummy add

* revert changes to yaml

---------

Co-authored-by: Anmol Shrestha <[email protected]>
Co-authored-by: Anmol Shrestha <[email protected]>
  • Loading branch information
3 people authored Feb 20, 2024
1 parent ceff52e commit cbac2a0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ jobs:
pnpm publish-packages-dev -y --branch ${{ github.ref_name }} --message "Version bump [skip actions]"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_ITWIN }}

7 changes: 2 additions & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# validate email
emailPattern="[^@]+@users\\.noreply\\.github\\.com"
email=$(git config user.email)

if ! [[ $email =~ $emailPattern ]]; then
if echo "$email" | grep -qvE "$emailPattern"; then
echo "Git commits should be using an e-mail like this pattern: \"$emailPattern\""
echo "But yours is configured like this: $email"
echo "To fix it, you can use command like this:"
echo "git config --local user.email \"[email protected]\""
exit 1;
fi
fi
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"version-bump-dev": "beachball bump --config beachball.config.dev.js --keep-change-files",
"publish-packages": "beachball publish",
"publish-packages-dev": "beachball publish --config beachball.config.dev.js --keep-change-files",
"prepare": "husky install"
"prepare": "husky"
},
"author": {
"name": "Bentley Systems, Inc.",
Expand Down Expand Up @@ -56,7 +56,7 @@
"@types/node": "20.11.16",
"beachball": "^2.39.0",
"eslint": "^8.56.0",
"husky": "^9.0.5",
"husky": "^9.0.11",
"mocha": "^10.2.0",
"typescript": "~5.3.3"
}
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cbac2a0

Please sign in to comment.