From 800d104035381f31af806ca707882995666c896c Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Mon, 6 Jan 2025 14:11:12 +0800 Subject: [PATCH 1/3] aggregate and auto-close dependency PRs --- .github/dependabot.yml | 12 +++++- .../workflows/close-old-dependency-prs.yml | 39 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/close-old-dependency-prs.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 949bd28a37e..fa66a87a908 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,7 +7,11 @@ updates: day: "saturday" time: "04:20" timezone: "America/New_York" - open-pull-requests-limit: 3 + open-pull-requests-limit: 1 + groups: + all-dependencies: + patterns: + - "*" - package-ecosystem: "github-actions" directory: "/" @@ -25,4 +29,8 @@ updates: day: "saturday" time: "04:20" timezone: "America/New_York" - open-pull-requests-limit: 3 + open-pull-requests-limit: 1 + groups: + all-dependencies: + patterns: + - "*" diff --git a/.github/workflows/close-old-dependency-prs.yml b/.github/workflows/close-old-dependency-prs.yml new file mode 100644 index 00000000000..dd56208e156 --- /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: ubuntu-latest + + 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 From 80d0500cc2504f29d2b867b03a92820e0c4bc4f4 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Mon, 6 Jan 2025 14:20:09 +0800 Subject: [PATCH 2/3] Update dependabot.yml --- .github/dependabot.yml | 74 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 10 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fa66a87a908..e05c03f8420 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,9 +3,9 @@ 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: 1 groups: @@ -17,20 +17,74 @@ updates: 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: 1 groups: - all-dependencies: + 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/**" From 862016070e2f43ae1aff746e4fdc80f6f2f51288 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Mon, 6 Jan 2025 14:28:26 +0800 Subject: [PATCH 3/3] Update close-old-dependency-prs.yml --- .github/workflows/close-old-dependency-prs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/close-old-dependency-prs.yml b/.github/workflows/close-old-dependency-prs.yml index dd56208e156..c1bc1d3d298 100644 --- a/.github/workflows/close-old-dependency-prs.yml +++ b/.github/workflows/close-old-dependency-prs.yml @@ -7,7 +7,7 @@ on: jobs: close_old_dependabot_prs: - runs-on: ubuntu-latest + runs-on: [arc-runner-set] steps: - name: Checkout Repository