Skip to content

fix: update CI workflow and pre-push hook to include 'dev' branch restrictions#19

Merged
humanbydefinition merged 1 commit into
devfrom
dev-branch-restrictions
Jun 13, 2026
Merged

fix: update CI workflow and pre-push hook to include 'dev' branch restrictions#19
humanbydefinition merged 1 commit into
devfrom
dev-branch-restrictions

Conversation

@humanbydefinition

Copy link
Copy Markdown
Owner

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the .husky/pre-push hook to restrict direct pushes to the dev branch in addition to beta and main. The reviewer identified a reliability issue where checking the local branch (HEAD) can be bypassed during pushes, and provided a code suggestion to read target remote refs from standard input instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread .husky/pre-push
Comment on lines +3 to +4
if [ "$branch" = "dev" ] || [ "$branch" = "beta" ] || [ "$branch" = "main" ]; then
echo "Direct pushes to '$branch' are not allowed. Open a pull request to dev, then promote dev -> beta -> main."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Checking the current local branch (HEAD) in a pre-push hook is unreliable and can be easily bypassed. For example, if a developer is on a feature branch but runs git push origin feature:dev, the hook will check the current branch (feature) and allow the direct push to dev. Conversely, if they are on dev and push to a safe personal branch, they will be blocked.

Instead, a pre-push hook should read the refs being pushed from standard input (stdin). We can use grep to check if any of the target remote refs match the protected branches (dev, beta, or main).

if grep -qE '^[^ ]+ [^ ]+ refs/heads/(dev|beta|main) '; then
  echo "Direct pushes to protected branches are not allowed. Open a pull request to dev, then promote dev -> beta -> main."

@humanbydefinition humanbydefinition merged commit 18cf671 into dev Jun 13, 2026
2 checks passed
@humanbydefinition humanbydefinition deleted the dev-branch-restrictions branch June 13, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant