ci: Fix silent missing metadata for release notes (#6089)

* Fix use of `mapfile < <(cmd)` which silently hid errors

* Fix script paths since `SCRIPT_DIR` changed in `lib.sh`

* Set `GITHUB_TOKEN` in release.yaml
This commit is contained in:
Mathias Fredriksson
2023-02-08 14:40:52 +02:00
committed by GitHub
parent 1dc477819e
commit f6da0a6945
5 changed files with 18 additions and 15 deletions
+6 -5
View File
@@ -53,7 +53,8 @@ main() {
security_label=security
# Get abbreviated and full commit hashes and titles for each commit.
mapfile -t commits < <(git log --no-merges --pretty=format:"%h %H %s" "$range")
git_log_out="$(git log --no-merges --pretty=format:"%h %H %s" "$range")"
mapfile -t commits <<<"$git_log_out"
# If this is a tag, use rev-list to find the commit it points to.
from_commit=$(git rev-list -n 1 "$from_ref")
@@ -69,8 +70,7 @@ main() {
# 27386d49d08455b6f8fbf2c18f38244d03fda892 author:hello labels:label:security
# d9f2aaf3b430d8b6f3d5f24032ed6357adaab1f1 author:world
# fd54512858c906e66f04b0744d8715c2e0de97e6 author:bye labels:label:stale label:enhancement
from_commit_date=2023-01-18
mapfile -t pr_labels_raw < <(
pr_list_out="$(
gh pr list \
--base main \
--state merged \
@@ -78,9 +78,10 @@ main() {
--search "merged:>=$from_commit_date" \
--json mergeCommit,labels,author \
--jq '.[] | "\( .mergeCommit.oid ) author:\( .author.login ) labels:\(["label:\( .labels[].name )"] | join(" "))"'
)
)"
mapfile -t pr_metadata_raw <<<"$pr_list_out"
declare -A authors labels
for entry in "${pr_labels_raw[@]}"; do
for entry in "${pr_metadata_raw[@]}"; do
commit_sha_long=${entry%% *}
commit_author=${entry#* author:}
commit_author=${commit_author%% *}