From ff6fed547c57e4b827c961bff614d570df10e188 Mon Sep 17 00:00:00 2001 From: skudasov Date: Fri, 13 Sep 2024 12:44:14 +0200 Subject: [PATCH] try n to m repos to packages search --- .../dependabot-consumers-summary.yaml | 54 ++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dependabot-consumers-summary.yaml b/.github/workflows/dependabot-consumers-summary.yaml index 027ecefc1..75aa16bf6 100644 --- a/.github/workflows/dependabot-consumers-summary.yaml +++ b/.github/workflows/dependabot-consumers-summary.yaml @@ -11,27 +11,53 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Set up jq for JSON parsing - run: sudo apt-get install -y jq + run: | + sudo apt-get install -y jq - name: Find Dependabot PRs env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Define the list of repositories - repos=("smartcontractkit/chainlink" "smartcontractkit/chainlink-solana") - - # Define the title pattern to search for - title_pattern="Bump github.com/smartcontractkit/chainlink-solana from" + repos=( + "smartcontractkit/chainlink" + "smartcontractkit/chainlink-solana" + "smartcontractkit/chainlink-cosmos" + "smartcontractkit/chainlink-starknet" + "smartcontractkit/.github" + "smartcontractkit/ccip" + ) + + # Define the list of packages to search for + pkgs=( + "github.com/smartcontractkit/chainlink-solana" +# "github.com/smartcontractkit/chainlink-testing-framework/lib" +# "github.com/smartcontractkit/another-package" +# "github.com/smartcontractkit/example-dependency" + ) + + # Initialize the summary with a heading + echo "# Dependabot PRs for Bumping Dependencies" >> "$GITHUB_STEP_SUMMARY" + + # Loop through each repository and package + for repo in "${repos[@]}"; do + for pkg in "${pkgs[@]}"; do + # Construct the title pattern to search for + title_pattern="Bump $pkg from" - echo "# Dependabot PRs for Bumping chainlink-testing-framework/lib" >> "$GITHUB_STEP_SUMMARY" + # Print the repository and package in the summary + echo "## Repository: ${repo}, Dependent: ${pkg}" >> "$GITHUB_STEP_SUMMARY" - for repo in "${repos[@]}"; do - echo "## Repository: $repo" >> $GITHUB_STEP_SUMMARY - prs=$(gh pr list --repo $repo --search "$title_pattern" --json title,url) - if [ -z "$prs" ]; then - echo "No PRs found for this repository" >> "$GITHUB_STEP_SUMMARY" - else - echo "$prs" | jq -r '.[] | "- [\(.title)](\(.url))"' >> "$GITHUB_STEP_SUMMARY" - fi + # Search for PRs matching the pattern + prs=$(gh pr list --repo "$repo" --search "$title_pattern" --json title,url) + + # If no PRs found, print a message + if [ -z "$prs" ]; then + echo "No PRs found for $pkg in $repo" >> "$GITHUB_STEP_SUMMARY" + else + # Print the PRs in the summary + echo "$prs" | jq -r '.[] | "- [\(.title)](\(.url))"' >> "$GITHUB_STEP_SUMMARY" + fi + done done - name: Print Summary