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 5f1d6a3
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions .github/workflows/dependabot-consumers-summary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,50 @@ 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"
)
# 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 5f1d6a3

Please sign in to comment.