From e98bdade4dbb8f095b998963c673f8987fbfde8d 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 | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dependabot-consumers-summary.yaml b/.github/workflows/dependabot-consumers-summary.yaml index 027ecefc1..09aca5189 100644 --- a/.github/workflows/dependabot-consumers-summary.yaml +++ b/.github/workflows/dependabot-consumers-summary.yaml @@ -17,21 +17,46 @@ jobs: 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