diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 949bd28a37..e05c03f842 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,26 +3,88 @@ updates: - package-ecosystem: "gomod" directory: "/" schedule: - interval: "weekly" - day: "saturday" - time: "04:20" + interval: "monthly" + day: "1" + time: "01:00" timezone: "America/New_York" - open-pull-requests-limit: 3 + open-pull-requests-limit: 1 + groups: + all-dependencies: + patterns: + - "*" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "monthly" - day: "saturday" - time: "04:20" + day: "1" + time: "02:00" timezone: "America/New_York" open-pull-requests-limit: 1 - package-ecosystem: "npm" directory: "/" schedule: - interval: "weekly" - day: "saturday" - time: "04:20" + interval: "monthly" + day: "1" + time: "03:00" timezone: "America/New_York" - open-pull-requests-limit: 3 + open-pull-requests-limit: 1 + groups: + balance-monitor: + patterns: + - "balance-monitor/**" + eventindexer: + patterns: + - "eventindexer/**" + monitors: + patterns: + - "monitors/**" + supplementary-contracts: + patterns: + - "supplementary-contracts/**" + blobstorage: + patterns: + - "blobstorage/**" + fork-diff: + patterns: + - "fork-diff/**" + nfts: + patterns: + - "nfts/**" + taiko-client: + patterns: + - "taiko-client/**" + branding: + patterns: + - "branding/**" + geth-rpc-gateway: + patterns: + - "geth-rpc-gateway/**" + protocol: + patterns: + - "protocol/**" + taikoon-ui: + patterns: + - "taikoon-ui/**" + bridge-ui: + patterns: + - "bridge-ui/**" + guardian-prover-health-check: + patterns: + - "guardian-prover-health-check/**" + guardian-prover-health-check-ui: + patterns: + - "guardian-prover-health-check-ui/**" + relayer: + patterns: + - "relayer/**" + ui-lib: + patterns: + - "ui-lib/**" + docs-site: + patterns: + - "docs-site/**" + snaefell-ui: + patterns: + - "snaefell-ui/**" diff --git a/.github/workflows/close-old-dependency-prs.yml b/.github/workflows/close-old-dependency-prs.yml new file mode 100644 index 0000000000..c1bc1d3d29 --- /dev/null +++ b/.github/workflows/close-old-dependency-prs.yml @@ -0,0 +1,39 @@ +name: Close Old Dependabot PRs + +on: + pull_request: + types: + - opened + +jobs: + close_old_dependabot_prs: + runs-on: [arc-runner-set] + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Close Old Dependabot PRs by Ecosystem and Directory + env: + NEW_PR_TITLE: ${{ github.event.pull_request.title }} + NEW_PR_BRANCH: ${{ github.event.pull_request.head.ref }} + run: | + REPO="${{ github.repository }}" + NEW_BRANCH_PREFIX=$(echo "$NEW_PR_BRANCH" | awk -F'/' '{print $1"/"$2"/"$3}') # Extract prefix: dependabot/npm_and_yarn/ + + echo "New PR Branch Prefix: $NEW_BRANCH_PREFIX" + + # Fetch all open Dependabot PRs + gh pr list --repo "$REPO" --state open --json number,title,headRef | jq -c '.[]' | while read -r pr; do + PR_NUMBER=$(echo "$pr" | jq -r '.number') + PR_TITLE=$(echo "$pr" | jq -r '.title') + PR_BRANCH=$(echo "$pr" | jq -r '.headRef') + + # Match PRs in the same directory and ecosystem + PR_BRANCH_PREFIX=$(echo "$PR_BRANCH" | awk -F'/' '{print $1"/"$2"/"$3}') + + if [[ "$PR_BRANCH_PREFIX" == "$NEW_BRANCH_PREFIX" && "$PR_TITLE" != "$NEW_PR_TITLE" ]]; then + echo "Closing old PR #$PR_NUMBER: $PR_TITLE" + gh pr close "$PR_NUMBER" --repo "$REPO" --delete-branch + fi + done