提交 27b63678 作者: Jakub Sztandera

misc: add confirmation to archive-branches script

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 5622cc5b
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -x
auth=""
#auth="-u kubuxu:$GH_TOKEN"
......@@ -48,9 +47,23 @@ active_branches() {
git remote add archived "git@github.com:$org/$arch_repo.git" || true
cat <(active_branches) <(pr_branches) <((IFS=$'\n'; echo "${exclusions[*]}")) \
| sort -u | comm - <(origin_refs | sort) -13 |\
while read -r ref; do
branches_to_move="$(cat <(active_branches) <(pr_branches) <((IFS=$'\n'; echo "${exclusions[*]}")) | sort -u | comm - <(origin_refs | sort) -13)"
echo "================"
printf "%s\n" "$branches_to_move"
echo "================"
echo "Please confirm move of above branches [y/N]:"
read line
case $line in
[Yy]|[Yy][Ee][Ss]) ;;
*) exit 1 ;;
esac
printf "%s\n" "$branches_to_move" | \
while read -r ref; do
git push archived "origin/$ref:refs/heads/$ref/$(date --rfc-3339=date)"
git push origin --delete "$ref"
done
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论