Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dev] Make nodejs pre-commit hook more resilient #6836

Merged
merged 7 commits into from
Jan 8, 2022

Conversation

paulcam206
Copy link
Member

@paulcam206 paulcam206 commented Dec 9, 2021

Description

Fix up a small issue with the new pre-commit hook that I encountered -- it's possible to get into a state where the client hook is registered, but husky itself isn't installed:

  1. cd source/nodejs && npm i
  2. git clean -dxf .
  3. touch ../android/commit-me.txt && git add --all && git commit -m "test commit"

At this point, the hook will execute, but since source/nodejs/.husky/_/husky.sh doesn't exist (wiped by git clean), the hook will fail here and prevent the commit.

The fix is to change the pre-commit hook to only apply if husky is in a good state.

Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Dec 15, 2021

Hi @paulcam206. This pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along.

@jonmill jonmill marked this pull request as draft December 16, 2021 18:47
@ghost ghost removed the no-recent-activity label Jan 3, 2022
@ghost
Copy link

ghost commented Jan 3, 2022

Staleness reset by paulcam206

@paulcam206 paulcam206 marked this pull request as ready for review January 3, 2022 19:43
@paulcam206
Copy link
Member Author

@licanhua - looks like the clang-format task is failing... why does it care about package-lock.json?

@licanhua
Copy link
Contributor

licanhua commented Jan 6, 2022

@licanhua - looks like the clang-format task is failing... why does it care about package-lock.json?
I have PR #6869 to address the problem.
After clang-format check, I did git status -s check in https://github.com/licanhua/clang-format-launcher/blob/78be8a7d5d863797ed76e1ca2f348f592ba77734/src/index.ts#L187

@paulcam206 paulcam206 enabled auto-merge (squash) January 8, 2022 00:37
@paulcam206 paulcam206 merged commit 5b66a52 into main Jan 8, 2022
@paulcam206 paulcam206 deleted the paulcam/hook-halfstate branch January 8, 2022 01:04
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
Co-authored-by: Canhua Li <licanhua@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants