Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6404: prevent contributors from opening a PR on a main branch #6419

Conversation

rakeshkumar1019
Copy link
Contributor

#6404

Used a Git hook(pre-push) to prevent pull requests from being created from the main branch.
pre-push hook ref: https://git-scm.com/docs/git-push

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Introduced a pre-push Git hook to prevent contributors from pushing directly from the main branch, enforcing better branching practices.

  • Added hooks/pre-push to check the current branch and exit with an error if it is 'main'.
  • Updated package.json to include a postinstall script that runs scripts/setup-hooks.sh.
  • Added scripts/setup-hooks.sh to automate the installation of the pre-push Git hook.

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@FelixMalfait
Copy link
Member

Hey Rakesh, not a fan of git hooks as I feel they can be a bit annoying / we prefer to educate rather than constrain. But happy to merge the documentation change in CONTRIBUTING.md if you leave just that! Thanks a lot

@rakeshkumar1019 rakeshkumar1019 marked this pull request as draft July 26, 2024 05:19
@rakeshkumar1019 rakeshkumar1019 marked this pull request as ready for review July 26, 2024 05:22
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

The pre-push Git hook and related setup scripts were removed, shifting the approach to prevent contributors from opening PRs from the main branch.

  • Removed hooks/pre-push, eliminating the automated branch check.
  • Deleted scripts/setup-hooks.sh, which previously installed the pre-push hook.
  • Modified package.json to remove the postinstall script that executed setup-hooks.sh.

These changes indicate a move away from using Git hooks for branch management.

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

LGTM! :)

@charlesBochet charlesBochet merged commit 0349d02 into twentyhq:main Jul 26, 2024
3 checks passed
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.

3 participants