Skip to content

Instantly share code, notes, and snippets.

View anthonydahanne's full-sized avatar

Anthony Dahanne anthonydahanne

View GitHub Profile
@anthonydahanne
anthonydahanne / force-push-to-main-branch.sh
Created April 24, 2023 21:19
Github has disabled force-push to the main branch; except that sometimes, that can come in handy. Use this gist with care ❤️
git checkout -b other-main
git push origin other-main
gh api -XPATCH "repos/pivotal-cf/tanzu-bellsoft-liberica" -f default_branch="other-main" >/dev/null
git push --delete tanzu main
gh api "repos/pivotal-cf/tanzu-bellsoft-liberica/branches/other-main/rename" -f new_name="main" >/dev/null
git checkout main
git pull origin main
# from https://stackoverflow.com/a/67638584/24069
# read each item in the JSON array to an item in the Bash array
set +x
readarray -t my_array < <(jq --raw-output '.[]' $1)
# iterate through the Bash array
for item in "${my_array[@]}"; do
git clone git@github.com:$item.git &>/dev/null
cd ${item#*/}
@anthonydahanne
anthonydahanne / UpdateReleaseNumbersPivnet
Last active July 7, 2023 14:02
Update release numbers on pivnet
A simple go app to connect to TanzuNet / Pivnet and update the release versions; to match the expected schema X.Y.Z instead of X.Y
@anthonydahanne
anthonydahanne / update-with-hacktoberfest-label.sh
Last active October 5, 2023 20:20
Script to ad the hacktoberfest label to existing issues matching a label
gh search issues --owner paketo-buildpacks --label "note:ideal-for-contribution" --limit 1000 --json repository,number | jq -r '.[] | [.number,.repository.nameWithOwner] | @tsv' | while IFS=$'\t' read -r number repository; do
echo "gh label -R $repository create hacktoberfest --description \"Hacktoberfest eligible\" --color D93F0B --force"
gh label -R $repository create hacktoberfest --description "Hacktoberfest eligible" --color D93F0B --force
echo "gh repo edit $repository --add-topic hacktoberfest"
gh repo edit $repository --add-topic hacktoberfest
echo "gh issue edit $number -R $repository --add-label \"hacktoberfest\""
gh issue edit $number -R $repository --add-label "hacktoberfest"
done
@anthonydahanne
anthonydahanne / update-tags.sh
Created December 22, 2023 00:24
Bash script to rename tags locally and remotely; with an exception
#!/bin/bash
for n in $(git tag)
do
if [ $n != "v6.0.4" ]; then
git tag ${n/v} $n
git tag -d $n
git push origin ${n/v} :$n
fi
done