Skip to content

Commit

Permalink
chore: add CI environment variables to release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
carlmw committed Feb 27, 2024
1 parent 468d0e1 commit 5418905
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Release
on:
workflow_run:
workflows: Verify
branches: main
types: completed
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read # for checkout
Expand Down Expand Up @@ -35,4 +33,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
CI: true
run: npx semantic-release
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if [ "$CI" == "true" ]; then
echo "Skipping pre-commit hook in CI"
exit 0
fi

npm run format:precommit
npm run lint:precommit
npm run check-types
7 changes: 6 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if [ "$CI" == "true" ]; then
echo "Skipping pre-push hook in CI"
exit 0
fi

git diff-index --quiet HEAD -- || (echo "Error: You have uncommitted changes. Please commit or stash them before pushing." && exit 1)

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "main" ]; then
if [ "$branch" = "main" ]; then
echo "Main Branch push is blocked"
exit 1
fi
Expand Down

0 comments on commit 5418905

Please sign in to comment.