Skip to content

Commit

Permalink
try n to m repos to packages search
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov committed Sep 13, 2024
1 parent 57d2fd3 commit e98bdad
Showing 1 changed file with 38 additions and 13 deletions.
51 changes: 38 additions & 13 deletions .github/workflows/dependabot-consumers-summary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e98bdad

Please sign in to comment.