Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependabot script to use directories: key #9252

Merged
merged 2 commits into from
Jan 8, 2025
Merged
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
26 changes: 10 additions & 16 deletions scripts/generate-dependabot-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set -euo pipefail

dependabot_file=.github/dependabot.yml

# Clear the dependabot file
> $dependabot_file

# Get a list of Terraform folders
all_tf_folders=`find . -type f -name '*.tf' | sed 's#/[^/]*$##' | sed 's/.\///'| sort | uniq`
echo
Expand All @@ -14,7 +17,7 @@ echo "Writing dependabot.yml file"
# Creates a dependabot file to avoid having to manually add each new TF folder
# Add any additional fixed entries in this top section
cat > $dependabot_file << EOL
# This file is auto-generated here, do not manually amend.
# This file is auto-generated here, do not manually amend.
# scripts/generate-dependabot.sh

version: 2
Expand All @@ -24,22 +27,13 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: "daily"
reviewers:
- "ministryofjustice/devcontainer-community"
# Dependabot doesn't currently support wildcard or multiple directory declarations within
# a dependabot configuration, so we need to add all directories individually
# See: github.com/dependabot/dependabot-core/issues/2178
EOL

for folder in $all_tf_folders
do
echo "Generating entry for ${folder}"
echo "Generating entry for Terraform ecosystem"
echo " - package-ecosystem: \"terraform\"" >> $dependabot_file
echo " directory: \"/${folder}\"" >> $dependabot_file
echo " schedule:" >> $dependabot_file
echo " interval: \"daily\"" >> $dependabot_file
echo " directories:" >> $dependabot_file
for folder in $all_tf_folders; do
echo " - \"/$folder\"" >> $dependabot_file
done
echo " schedule:" >> $dependabot_file
echo " interval: \"daily\"" >> $dependabot_file
Loading