Skip to content

Commit

Permalink
chore(tools): show PR title along with PR url
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyZhang0707 committed Dec 3, 2024
1 parent 9b2e133 commit bd716f5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions changelog/verify-prs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function get_commits_prs () {
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/search/issues?q=$full_q" | jq -r '.items[].html_url' | tee -a "$prs_file"
"https://api.github.com/search/issues?q=$full_q" | jq -r '.items[]|"\(.html_url) - \(.title)"' | tee -a "$prs_file"

full_q="$BASE_Q"
fi
Expand All @@ -276,7 +276,8 @@ function check_pr_changelog () {

local changelog_pattern="changelog/unreleased/kong*/*.yml"
local req_url="https://api.github.com/repos/${ORG_REPO}/pulls/PR_NUMBER/files"
local pr_number="${1##https*/}"
local pr_number="${1%% - *}"
pr_number="${pr_number##https*/}"
req_url="${req_url/PR_NUMBER/$pr_number}"
mapfile -t < <( curl -sSL \
-H "User-Agent: ${USER_AGENT}" \
Expand All @@ -300,7 +301,7 @@ function check_changelog () {
parallel -j "$BULK" check_pr_changelog <"$1"
else
warn "WARNING: GNU 'parallel' is not available, fallback to 'xargs'"
<"$1" xargs -P "$BULK" -n1 bash -c 'check_pr_changelog "$@"' _
cat "$1" | tr '\n' '\0'| xargs -0 -P "$BULK" -n1 bash -c 'check_pr_changelog "$@"' _
fi
sort -uo "$prs_no_changelog_file" "$prs_no_changelog_file"
}
Expand All @@ -310,7 +311,8 @@ function check_cherrypick_label () {

local label_pattern="cherry-pick kong-ee"
local req_url="https://api.github.com/repos/${ORG_REPO}/issues/PR_NUMBER/labels"
local pr_number="${1##https://*/}"
local pr_number="${1%% - *}"
pr_number="${pr_number##https*/}"
req_url="${req_url/PR_NUMBER/$pr_number}"
mapfile -t < <( curl -sSL \
-H "User-Agent: ${USER_AGENT}" \
Expand All @@ -330,7 +332,8 @@ function check_cross_reference () {
if [[ -z "${1:+x}" ]] ; then return ; fi

local req_url="https://api.github.com/repos/${ORG_REPO}/issues/PR_NUMBER/timeline"
local pr_number="${1##https://*/}"
local pr_number="${1%% - *}"
pr_number="${pr_number##https*/}"
req_url="${req_url/PR_NUMBER/$pr_number}"

local first_paged_response
Expand Down Expand Up @@ -391,7 +394,7 @@ function check_cross_reference () {
}

function check_ce2ee () {
if [[ "$ORG_REPO" != "kong/kong" && "$ORG_REPO" != "Kong/kong" ]] ; then
if [[ "${ORG_REPO,,}" != "kong/kong" ]] ; then
warn "WARNING: only check CE2EE for CE repo. Skip $ORG_REPO"
return
fi
Expand All @@ -403,7 +406,7 @@ function check_ce2ee () {
parallel -j "$BULK" check_cherrypick_label <"$1"
else
warn "WARNING: GNU 'parallel' is not available, fallback to 'xargs'"
<"$1" xargs -P "$BULK" -n1 bash -c 'check_cherrypick_label "$@"' _
cat "$1" |tr '\n' '\0' | xargs -0 -P "$BULK" -n1 bash -c 'check_cherrypick_label "$@"' _
fi
sort -uo "$prs_no_cherrypick_label_file" "$prs_no_cherrypick_label_file"

Expand All @@ -429,7 +432,7 @@ function check_ce2ee () {
parallel -j "$BULK" check_cross_reference <"$1"
else
warn "WARNING: GNU 'parallel' is not available, fallback to 'xargs'"
<"$1" xargs -P "$BULK" -n1 bash -c 'check_cross_reference "$@"' _
cat "$1" |tr '\n' '\0' | xargs -0 -P "$BULK" -n1 bash -c 'check_cross_reference "$@"' _
fi
fi
sort -uo "$prs_no_cross_reference_file" "$prs_no_cross_reference_file"
Expand Down

0 comments on commit bd716f5

Please sign in to comment.