From 9539c2ea5229d2ad9e00bb6b82a78ecd534939cb Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Fri, 26 Jul 2024 10:01:39 +0530 Subject: [PATCH 1/4] 6404: prevent contributors from opening a PR on a main branch --- hooks/pre-push | 6 ++++++ package.json | 3 ++- scripts/setup-hooks.sh | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 hooks/pre-push create mode 100644 scripts/setup-hooks.sh diff --git a/hooks/pre-push b/hooks/pre-push new file mode 100644 index 000000000000..b11ca879fde7 --- /dev/null +++ b/hooks/pre-push @@ -0,0 +1,6 @@ +#!/bin/sh +branch_name=$(git symbolic-ref HEAD 2>/dev/null | awk -F/ '{print $NF}') +if [ "$branch_name" = "main" ]; then + echo "Pushing directly from the main branch is not allowed. Please create a new branch." + exit 1 +fi diff --git a/package.json b/package.json index 44e90e7e33fd..3eecc0ebecd4 100644 --- a/package.json +++ b/package.json @@ -357,6 +357,7 @@ "version": "0.2.1", "nx": {}, "scripts": { + "postinstall": "sh scripts/setup-hooks.sh", "start": "npx nx run-many -t start -p twenty-server twenty-front" }, "workspaces": { @@ -372,4 +373,4 @@ "tools/eslint-rules" ] } -} +} \ No newline at end of file diff --git a/scripts/setup-hooks.sh b/scripts/setup-hooks.sh new file mode 100644 index 000000000000..7ea25002597a --- /dev/null +++ b/scripts/setup-hooks.sh @@ -0,0 +1,4 @@ +#!/bin/sh +cp hooks/pre-push .git/hooks/ +chmod +x .git/hooks/pre-push +echo "Git hooks installed successfully." From 3de3efaf8482db36b7c57baf903a2d31ad352e63 Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Fri, 26 Jul 2024 10:18:00 +0530 Subject: [PATCH 2/4] 6404: update contributing.md file --- .github/CONTRIBUTING.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c8633c541ad8..8a57d7b34744 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -42,35 +42,39 @@ Therefore, ensure you are assigned to an issue before beginning work on it. git clone https://github.com/yourusername/twenty.git cd twenty ``` +3. **Create a New Branch:** Create a new branch for your changes instead of using the main branch. +```shell +git checkout -b your-branch-name +``` -3. **Make Changes:** Make your desired changes and ensure that your code adheres to Twenty's coding standards. +4. **Make Changes:** Make your desired changes and ensure that your code adheres to Twenty's coding standards. -4. **Test Locally:** Test your changes locally to ensure they work as expected. +5. **Test Locally:** Test your changes locally to ensure they work as expected. -5. **Commit Changes:** Commit your changes with a clear and concise commit message. +6. **Commit Changes:** Commit your changes with a clear and concise commit message. ```shell git commit -m "Add your detailed description here" ``` -6. **Push Changes:** Push your changes to your forked repository. +7. **Push Changes:** Push your changes to your forked repository. ```shell -git push origin branch-name +git push origin your-branch-name ``` -7. **Create a Pull Request:** Go to the original Twenty repository and create a pull request. Please provide a detailed description of your changes. To have your pull request accepted, you must sign a CLA. +8. **Create a Pull Request:** Go to the original Twenty repository and create a pull request. Please provide a detailed description of your changes. To have your pull request accepted, you must sign a CLA. -8. **Code Review:** Your pull request will undergo a code review. Note that you might need to make any necessary adjustments based on feedback. +9. **Code Review:** Your pull request will undergo a code review. Note that you might need to make any necessary adjustments based on feedback. -9. **Merge:** Once approved, maintainers will merge your pull request into the main repository. +10. **Merge:** Once approved, maintainers will merge your pull request into the main repository.
From 160d3f992551c4ceb4984d09733c4f14f098b502 Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Fri, 26 Jul 2024 10:38:22 +0530 Subject: [PATCH 3/4] 6404: remove pre-fetch hook --- hooks/pre-push | 6 ------ package.json | 1 - scripts/setup-hooks.sh | 4 ---- 3 files changed, 11 deletions(-) delete mode 100644 hooks/pre-push delete mode 100644 scripts/setup-hooks.sh diff --git a/hooks/pre-push b/hooks/pre-push deleted file mode 100644 index b11ca879fde7..000000000000 --- a/hooks/pre-push +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -branch_name=$(git symbolic-ref HEAD 2>/dev/null | awk -F/ '{print $NF}') -if [ "$branch_name" = "main" ]; then - echo "Pushing directly from the main branch is not allowed. Please create a new branch." - exit 1 -fi diff --git a/package.json b/package.json index 3eecc0ebecd4..2ee5baa50caa 100644 --- a/package.json +++ b/package.json @@ -357,7 +357,6 @@ "version": "0.2.1", "nx": {}, "scripts": { - "postinstall": "sh scripts/setup-hooks.sh", "start": "npx nx run-many -t start -p twenty-server twenty-front" }, "workspaces": { diff --git a/scripts/setup-hooks.sh b/scripts/setup-hooks.sh deleted file mode 100644 index 7ea25002597a..000000000000 --- a/scripts/setup-hooks.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -cp hooks/pre-push .git/hooks/ -chmod +x .git/hooks/pre-push -echo "Git hooks installed successfully." From cc723b7e6ca426eca4a7634eaa4ac87479b71aeb Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Fri, 26 Jul 2024 10:52:09 +0530 Subject: [PATCH 4/4] 6404: revert package.json changes --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ee5baa50caa..44e90e7e33fd 100644 --- a/package.json +++ b/package.json @@ -372,4 +372,4 @@ "tools/eslint-rules" ] } -} \ No newline at end of file +}