From fb7c3d1a07c027808234cb5395d84976d5b358c4 Mon Sep 17 00:00:00 2001 From: Rahul Barwal Date: Thu, 1 May 2025 11:14:04 +0530 Subject: [PATCH] chore: adds depandabot.yml (#40521) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description We are implementing this to control Dependabot alerts and prevent flagging of the TinyMCE library, which we are maintaining at version 6.8.3. * Additionally, we have reverted the change that checks for TinyMCE version updates in the pre-commit hook. Managing this within the Dependabot configuration file is a better approach. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Sanity" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: bc960270a70184b00bfee7789dd3ae3d0c2cf7b5 > Cypress dashboard. > Tags: `@tag.Sanity` > Spec: >
Thu, 01 May 2025 05:43:58 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **Chores** - Added automated dependency update configuration to streamline npm package management, with specific rules for update frequency, labeling, and commit message formatting. - **Refactor** - Simplified pre-commit checks by removing restrictions related to TinyMCE version changes. --- .github/dependabot.yml | 27 +++++++++++++++++++++++++ app/client/.husky/check-staged-files.sh | 25 ++++------------------- 2 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..98543e8cf3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,27 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/app/client" + schedule: + interval: "weekly" + ignore: + - dependency-name: "tinymce" + versions: ["6.8.3"] + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "javascript" + commit-message: + prefix: "chore" + include: "scope" + - package-ecosystem: "maven" + directory: "/app/server" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "java" + commit-message: + prefix: "chore" + include: "scope" diff --git a/app/client/.husky/check-staged-files.sh b/app/client/.husky/check-staged-files.sh index 8a73539c2d..cf456b2339 100644 --- a/app/client/.husky/check-staged-files.sh +++ b/app/client/.husky/check-staged-files.sh @@ -2,26 +2,14 @@ is_server_change=$(git diff --cached --name-only | grep -c "app/server") is_client_change=$(git diff --cached --name-only | grep -c "app/client") -is_package_json_change=$(git diff --cached --name-only | grep -c "app/client/package.json") is_merge_commit=$(git rev-parse -q --verify MERGE_HEAD) -# Function to check TinyMCE version changes -check_tinymce_version() { - # Check if TinyMCE version is being changed - if git diff --cached app/client/package.json | grep -q '^-.*"tinymce": "6\.8\.3"' && - git diff --cached app/client/package.json | grep -q '^+.*"tinymce": "[^"]*"'; then - echo "❌ Error: Attempting to change TinyMCE version. This is not allowed as per team decision." - echo "Please keep TinyMCE at version 6.8.3" - exit 1 - fi -} - # Function to apply Spotless and only commit staged files apply_spotless_and_commit_staged_files() { - staged_server_files=$(git diff --cached --name-only | grep "app/server" | sed 's|app/server/||') + staged_server_files=$(git diff --cached --name-only | grep "app/server"| sed 's|app/server/||') mvn spotless:apply - # Check if Spotless succeeded + # Check if Spotless succeeded if [ $? -ne 0 ]; then echo "Spotless apply failed, Please run mvn spotless:apply" exit 1 @@ -33,16 +21,11 @@ apply_spotless_and_commit_staged_files() { if [ "$is_merge_commit" ]; then echo "Skipping server and client checks for merge commit" else - if [ "$is_package_json_change" -ge 1 ]; then - echo "Checking package.json changes..." - check_tinymce_version - fi - if [ "$is_server_change" -ge 1 ]; then echo "Applying Spotless to server files..." - pushd app/server >/dev/null + pushd app/server > /dev/null apply_spotless_and_commit_staged_files - popd >/dev/null + popd > /dev/null else echo "Skipping server side check..." fi