Set up husky

This commit is contained in:
Colin McDonnell
2025-08-27 18:13:10 -07:00
parent f6efe56478
commit 9239b40372
5 changed files with 246 additions and 232 deletions
+6 -13
View File
@@ -50,23 +50,16 @@ jobs:
echo "Tag ${{ steps.version.outputs.tag }} does not exist" echo "Tag ${{ steps.version.outputs.tag }} does not exist"
fi fi
- name: Install dependencies and build - name: Verify built files are up to date
if: steps.check_tag.outputs.exists == 'false' if: steps.check_tag.outputs.exists == 'false'
run: | run: |
pnpm install # Check if there are any uncommitted changes (built files should already be committed via pre-commit hook)
pnpm run build
- name: Commit built files if changed
if: steps.check_tag.outputs.exists == 'false'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
if [[ -n $(git status --porcelain) ]]; then if [[ -n $(git status --porcelain) ]]; then
git add dist/ echo "❌ Error: There are uncommitted changes. Built files should be committed via pre-commit hook."
git commit -m "chore: rebuild action for v${{ steps.version.outputs.version }}" git status
git push exit 1
fi fi
echo "✅ All built files are up to date"
- name: Create and push tags - name: Create and push tags
if: steps.check_tag.outputs.exists == 'false' if: steps.check_tag.outputs.exists == 'false'
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# Build the action before committing
echo "🔨 Building action..."
npm run build
# Add the built files to the commit
git add index.cjs dist/
+218 -218
View File
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -9,7 +9,8 @@
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "node esbuild.config.js", "build": "node esbuild.config.js",
"dev": "node esbuild.config.js --watch" "dev": "node esbuild.config.js --watch",
"prepare": "husky"
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1" "@actions/core": "^1.10.1"
@@ -17,6 +18,7 @@
"devDependencies": { "devDependencies": {
"@types/node": "^20.10.0", "@types/node": "^20.10.0",
"esbuild": "^0.25.9", "esbuild": "^0.25.9",
"husky": "^9.0.0",
"typescript": "^5.3.0" "typescript": "^5.3.0"
}, },
"repository": { "repository": {
+10
View File
@@ -18,6 +18,9 @@ importers:
esbuild: esbuild:
specifier: ^0.25.9 specifier: ^0.25.9
version: 0.25.9 version: 0.25.9
husky:
specifier: ^9.0.0
version: 9.1.7
typescript: typescript:
specifier: ^5.3.0 specifier: ^5.3.0
version: 5.9.2 version: 5.9.2
@@ -204,6 +207,11 @@ packages:
engines: {node: '>=18'} engines: {node: '>=18'}
hasBin: true hasBin: true
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
tunnel@0.0.6: tunnel@0.0.6:
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
@@ -351,6 +359,8 @@ snapshots:
'@esbuild/win32-ia32': 0.25.9 '@esbuild/win32-ia32': 0.25.9
'@esbuild/win32-x64': 0.25.9 '@esbuild/win32-x64': 0.25.9
husky@9.1.7: {}
tunnel@0.0.6: {} tunnel@0.0.6: {}
typescript@5.9.2: {} typescript@5.9.2: {}