Last active
December 18, 2025 00:15
-
-
Save jrobinsonc/f0c7f20cc11375346bb4147ba322cee4 to your computer and use it in GitHub Desktop.
Run pre-push checks only when the branch is not associated with a draft pull request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Skip pre-push checks only if the branch is linked to a draft pull request. | |
| # This script requires the GitHub CLI (gh), and the package Husky v9+. | |
| # Get the current branch name | |
| BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
| # Check if there's a PR for this branch and get its draft status | |
| PR_IS_DRAFT=$(gh pr view "$BRANCH" --json isDraft -q '.isDraft' 2>/dev/null || echo "false") | |
| # Check if PR is in draft status | |
| if [ "$PR_IS_DRAFT" = "true" ]; then | |
| PR_NUMBER=$(gh pr view "$BRANCH" --json number -q '.number' 2>/dev/null) | |
| echo "ℹ️ PR #$PR_NUMBER is in draft. Skipping pre-push checks." | |
| echo | |
| exit 0 | |
| fi | |
| echo "✓ Running pre-push checks..." | |
| echo | |
| pnpm turbo run check-types lint test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment