Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions gh-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,18 @@ Get repositories that have a CircleCI configuration file `.circleci/config.yml`

Get repositories that have a CodeQL configuration file `.github/workflows/codeql.yml`

### get-repositories-using-dependabot-version-updates.sh

Get repositories that have Dependabot version updates configured by checking for the presence of a `.github/dependabot.yml` file.

Usage:

```shell
./get-repositories-using-dependabot-version-updates.sh my-org
```

Returns a simple list of repository names followed by a count summary.

### get-repositories-webhooks-csv.sh

Gets a CSV with the list of repository webhooks in a GitHub organization.
Expand Down
45 changes: 45 additions & 0 deletions gh-cli/get-repositories-using-dependabot-version-updates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# Get repositories using Dependabot version updates
# This script finds all repositories in an organization that have a .github/dependabot.yml file
# Usage: ./get-repositories-using-dependabot-version-updates.sh <org>

if [ -z "$1" ]
then
echo "Usage: $0 <org>"
echo "Example: ./get-repositories-using-dependabot-version-updates.sh my-org"
exit 1
fi

org=$1

echo "🔍 Searching for repositories with Dependabot configuration in '$org'..."
echo ""

repositories=$(gh api graphql --paginate -F owner="$org" -f query='
query ($owner: String!, $endCursor: String) {
organization(login: $owner) {
repositories(first: 100, after: $endCursor) {
nodes {
name
object(expression: "HEAD:.github/dependabot.yml") {
id
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}' --jq '.data.organization.repositories.nodes[] | select(.object) | .name' | tr -d '"')

if [ -z "$repositories" ]; then
echo "❌ No repositories found with Dependabot configuration in '$org'"
exit 0
fi

echo "$repositories"
echo ""
count=$(echo "$repositories" | wc -l | tr -d ' ')
echo "Total: $count repositories with Dependabot configuration"