Skip to content

Commit 1cdef87

Browse files
committed
ci(bump): implement automatic PR creation
1 parent 3cad36d commit 1cdef87

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

latex/bump-apt-versions.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ if [ -f /.dockerenv ]; then
1515
v2="$(\apt-cache policy "${p}" | \grep -o -e 'Candidate: [^ ]*' | \sed -e 's/^Candidate: //')"
1616
if [ "${v1}" != "${v2}" ]; then
1717
\echo "${p} ${v1} -> ${v2}"
18-
\perl -i -p -e "s|\Q${l}\E|${p}=${v2}|g" Dockerfile
18+
\echo "${p},${v1},${v2},${p}=${v1},${p}=${v2}" >>.bump.csv.bak
1919
fi
2020
done
2121

2222
else
2323

2424
\docker run --pull always --rm -t --user root -v "$(pwd):/opt/bump" "leplusorg/${PWD##*/}:main" /opt/bump/"$(\basename "${0}")"
2525

26+
./create-prs.sh
27+
2628
fi

latex/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)