Skip to content

Commit 7022cdf

Browse files
committed
ci(bump): implement automatic PR creation
1 parent c1be9ca commit 7022cdf

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

aws-cli/create-prs.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
cd "$(\dirname "${0}")"
6+
7+
if [ -f .bump.csv.bak ]; then
8+
if [ "$(\git status --porcelain=1 | wc -l)" -ne 0 ]; then
9+
>&2 echo "error: git repo contains uncommitted changes"
10+
exit 1
11+
fi
12+
csv="$(\cat .bump.csv.bak)"
13+
\rm -f .bump.csv.bak
14+
while IFS="," read -r p v1 v2 l1 l2; do
15+
b="${p}-${v2}"
16+
\git switch --create "${b}"
17+
\perl -i -p -e "s|\Q${l1}\E|${l2}|g" Dockerfile
18+
\git add Dockerfile
19+
\git commit -S -m "build(deps): bump ${p} from ${v1} to ${v2}"
20+
read -n 1 -s -r -p "Please review and push commit in branch \"${b}\". Press enter to continue..."
21+
\gh pr create -f -l build -l dependencies
22+
\git checkout -
23+
done <<<"${csv}"
24+
else
25+
>&2 echo "error: nothing to do"
26+
exit 1
27+
fi

0 commit comments

Comments
 (0)