Set up husky
This commit is contained in:
@@ -50,23 +50,16 @@ jobs:
|
||||
echo "Tag ${{ steps.version.outputs.tag }} does not exist"
|
||||
fi
|
||||
|
||||
- name: Install dependencies and build
|
||||
- name: Verify built files are up to date
|
||||
if: steps.check_tag.outputs.exists == 'false'
|
||||
run: |
|
||||
pnpm install
|
||||
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"
|
||||
|
||||
# Check if there are any uncommitted changes (built files should already be committed via pre-commit hook)
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
git add dist/
|
||||
git commit -m "chore: rebuild action for v${{ steps.version.outputs.version }}"
|
||||
git push
|
||||
echo "❌ Error: There are uncommitted changes. Built files should be committed via pre-commit hook."
|
||||
git status
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ All built files are up to date"
|
||||
|
||||
- name: Create and push tags
|
||||
if: steps.check_tag.outputs.exists == 'false'
|
||||
|
||||
Executable
+9
@@ -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/
|
||||
+3
-1
@@ -9,7 +9,8 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
|
||||
"build": "node esbuild.config.js",
|
||||
"dev": "node esbuild.config.js --watch"
|
||||
"dev": "node esbuild.config.js --watch",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1"
|
||||
@@ -17,6 +18,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.10.0",
|
||||
"esbuild": "^0.25.9",
|
||||
"husky": "^9.0.0",
|
||||
"typescript": "^5.3.0"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
Generated
+10
@@ -18,6 +18,9 @@ importers:
|
||||
esbuild:
|
||||
specifier: ^0.25.9
|
||||
version: 0.25.9
|
||||
husky:
|
||||
specifier: ^9.0.0
|
||||
version: 9.1.7
|
||||
typescript:
|
||||
specifier: ^5.3.0
|
||||
version: 5.9.2
|
||||
@@ -204,6 +207,11 @@ packages:
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
husky@9.1.7:
|
||||
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
tunnel@0.0.6:
|
||||
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
|
||||
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
|
||||
@@ -351,6 +359,8 @@ snapshots:
|
||||
'@esbuild/win32-ia32': 0.25.9
|
||||
'@esbuild/win32-x64': 0.25.9
|
||||
|
||||
husky@9.1.7: {}
|
||||
|
||||
tunnel@0.0.6: {}
|
||||
|
||||
typescript@5.9.2: {}
|
||||
|
||||
Reference in New Issue
Block a user