actions / github-script

Write workflows scripting the GitHub API in JavaScript
MIT License
4.21k stars 421 forks source link

Upgrade husky to v9 #482

Closed benelan closed 3 months ago

benelan commented 3 months ago

Migrate to husky v9 following the instructions in their release notes.

For context, I got the following husky error when installing this package for JSDoc support:

❱ npm i -D @types/github-script@github:actions/github-script
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command npm install --force --cache=/home/****/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > github-script@7.0.1 prepare
npm ERR! > husky install
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! .git can't be found (see https://git.io/Jc3F9)
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /home/*****/.npm/_cacache/tmp/git-cloneXXXXXXDFwwTa
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c husky install
npm ERR!

I found a husky issue where people said the problem is fixed in newer versions: https://github.com/typicode/husky/issues/851

benelan commented 3 months ago

I just confirmed this PR resolves my error by installing via:

npm i -D @types/github-script@github:actions/github-script#pull/482

I use git worktrees, and it sounds using a non-standard location for GIT_DIR would break old versions of husky. The relevant line husky's release notes seems to be:

Modified behavior when .git is missing; it now triggers a warning instead of failure.

benelan commented 3 months ago

Thanks for the review! It's my first time contributing so I believe you need to manually run the PR check. Feel free to merge once the check passes since I don't have write permissions. Appreciate it!

joshmgross commented 3 months ago

Yep, ran into a couple internal issues with a feature we had enabled for this repository

https://github.com/actions/github-script/actions/runs/10087909477

I can push an empty commit to re-trigger CI

joshmgross commented 3 months ago

Ah looks like I don't have permissions to do that, do you mind pushing an empty commit to your branch?

benelan commented 3 months ago

I pushed an empty commit, let me know if you need anything else from my end! I have the "Allow edits by maintainers" box checked so I'm not sure why it didn't let you do it.

joshmgross commented 3 months ago

@benelan do you need a new release of the action to get unblocked or are you good with these changes just being in main for now?

benelan commented 3 months ago

The changes being on main unblocks the issue on my end. I can pin a release tag later but it's not a priority for me, thanks for asking!