Open utterances-bot opened 5 months ago
Thanks for a nice and easy solution... If you need something more "powerful" for updating multiple repos - you can use this tool: https://github.com/lindell/multi-gitter/
Thanks for a nice and easy solution... If you need something more "powerful" for updating multiple repos - you can use this tool: https://github.com/lindell/multi-gitter/
Woah @ruzickap that's a neat app, thanks for sharing 🎉! This accomplishes everything I'd ever want to do with my script, including creating the pull request for us and even providing commands to track whether that PR has been merged or not.
For myself for later, sharing some of my run tests:
# add to a single repository
multi-gitter run ./gitter-add-dependabot-file.sh -R joshjohanning-org/dependabot-yml-gitter -m "adding dependabot.yml"
# add using a repo search filter
multi-gitter run ./gitter-add-dependabot-file.sh --repo-search "org:joshjohanning-org topic:gitter" -m "adding dependabot.yml"
# add to entire org
multi-gitter run ./gitter-add-dependabot-file.sh -O joshjohanning-org-m "adding dependabot.yml"
# adding/customizing the pull request body
export PR_BODY=$'Adding a `dependabot.yml` file to the repo\n\nPlease review for accuracy and merge when ready!'
multi-gitter run ./gitter-add-dependabot-file.sh --repo-search "org:joshjohanning-org topic:gitter" -m "adding dependabot.yml" --pr-body "$PR_BODY"
# get status of the created pull requests
multi-gitter status --repo-search "org:joshjohanning-org topic:gitter"
# closing (not merging) the pull requests
multi-gitter close --repo-search "org:joshjohanning-org topic:gitter"
# merge in the pull requests
multi-gitter merge --repo-search "org:joshjohanning-org topic:gitter"
[!WARNING] add in
-d
to run adry-run
(see which repos it would be changing first!)
And my ./gitter-add-dependabot-file.sh
run script:
#!/bin/bash
# Relative path to the file to be replaced
FILE="./.github/dependabot.yml"
# Full path to the file to copy in
REPLACE_WITH_FILE=~/Repos/github-misc-scripts/scripts/dependabot.yml
if [ -f "$FILE" ]; then
echo "File $FILE exists."
else
echo "File $FILE does not exist. Creating..."
mkdir -p ./.github
cp $REPLACE_WITH_FILE $FILE
echo "File $FILE created."
fi
Here is a slightly more complex ./gitter-add-dependabot-file.sh
run script that creates a dependabot.yml
if it doesn't exist, but if it does exist, only check to see if there is a package-ecosystem: github-actions
section and if not, add it 😄
GitHub: Script to Add dependabot.yml to a List of Repos | josh-ops
Add the dependabot.yml file programmatically to a list of GitHub repositories
https://josh-ops.com/posts/github-script-to-add-dependabot-file/