@@ -18,8 +18,8 @@ REPO="$1"
1818echo " Checking for open Dependabot PRs to approve and merge in $REPO ..."
1919
2020# Get all open PRs from dependabot
21- # We filter so that only PRs that are not from forks and are in branches starting with "dependabot/cargo" are included.
22- dependabot_prs=$( gh pr list -R " $REPO " --author " dependabot[bot]" --state open --json number,title,reviews,headRepositoryOwner,headRefName | jq --arg repo_owner " $( echo " $REPO " | cut -d' /' -f1) " ' [.[] | select(.headRepositoryOwner.login == $repo_owner and (.headRefName | startswith("dependabot/cargo")))]' )
21+ # We filter so that only PRs that are not from forks and are in branches starting with "dependabot/cargo" or "dependabot/npm_and_yarn" are included.
22+ dependabot_prs=$( gh pr list -R " $REPO " --author " dependabot[bot]" --state open --json number,title,reviews,headRepositoryOwner,headRefName | jq --arg repo_owner " $( echo " $REPO " | cut -d' /' -f1) " ' [.[] | select(.headRepositoryOwner.login == $repo_owner and (( .headRefName | startswith("dependabot/cargo")) or (.headRefName | startswith("dependabot/npm_and_yarn") )))]' )
2323# Exit early if no PRs found
2424if [ -z " $dependabot_prs " ] || [ " $dependabot_prs " = " []" ]; then
2525 echo " No open Dependabot PRs found in $REPO "
@@ -39,16 +39,16 @@ echo "$dependabot_prs" | jq -c '.[]' | while read -r pr; do
3939
4040 # Check if PR only modifies allowed files
4141 pr_files=$( gh pr view " $pr_number " -R " $REPO " --json files)
42- invalid_files=$( echo " $pr_files " | jq -r ' .files[].path' | grep -v -E ' (Cargo\.toml|Cargo\.lock) ' || true)
42+ invalid_files=$( echo " $pr_files " | jq -r ' .files[].path' | grep -v -E ' (^|/)( Cargo\.toml|Cargo\.lock|package\.json|package-lock\.json)$ ' || true)
4343
4444 if [ -n " $invalid_files " ]; then
4545 echo " ❌ PR #$pr_number modifies files that are not allowed for auto-merge:"
4646 printf ' %s\n' " $invalid_files " | sed ' s/^/ - /'
47- echo " ℹ️ Only changes to Cargo.toml and Cargo.lock are allowed"
47+ echo " ℹ️ Only changes to Cargo.toml, Cargo.lock, package.json, and package-lock.json are allowed"
4848 continue
4949 fi
5050
51- echo " ✅ PR #$pr_number only modifies allowed files (Cargo.toml and Cargo.lock)"
51+ echo " ✅ PR #$pr_number only modifies allowed files (Cargo.toml, Cargo.lock, package.json, package-lock.json )"
5252
5353 # First, get detailed PR information including all checks
5454 pr_details=$( gh pr view " $pr_number " -R " $REPO " --json statusCheckRollup,state)
0 commit comments