File: create-changelog.sh

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 33,804 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,850; lisp: 1,106; xml: 1,049; makefile: 583; lex: 557
file content (43 lines) | stat: -rwxr-xr-x 945 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# author: Vicente Bolea <vicente.bolea@kitware.com>

function require_dependency()
{
  if ! command -v "$1" &> /dev/null
  then
    echo "[E] Missing dependencies: $1"
    exit 1
  fi
}

require_dependency "jq"
require_dependency "gh"
require_dependency "csvlook"

if [ "$#" != "2" ]
then
  echo "[E] Wrong arguments. Invoke as:"
  echo "scripts/developer/create-changelog.sh <new_release> <old_release>"
  exit 2
fi

new_release="$1"
old_release="$2"

prs="$(git log --oneline  --grep='Merge pull request ' "^${old_release}" "${new_release}" | grep -Po '\s#\K[0-9]+')"
num_prs="$(wc -w <<<"$prs")"

echo "[I] Found $num_prs PRs"

# Header first
output=("PR, Title")
i=0
for pr in ${prs}
do
  printf "\r[I] Processing: PR=%06d progress=%05d/%05d" "$pr" "$i" "$num_prs"
  output+=("$(gh api "/repos/ornladios/ADIOS2/pulls/$pr" | jq -r '["#\(.number)", .title] | @csv')")
  ((i++))
done
echo ""

printf '%s\n' "${output[@]}" | csvlook