You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by er...@apache.org on 2023/05/04 17:51:20 UTC
[trafficcontrol] branch master updated: Use GitHub API to get commit count since the last ATS release (#7489)
This is an automated email from the ASF dual-hosted git repository.
ericholguin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 7ce6717277 Use GitHub API to get commit count since the last ATS release (#7489)
7ce6717277 is described below
commit 7ce67172779f2acc48a8398467b97c9163797a77
Author: Zach Hoffman <zr...@apache.org>
AuthorDate: Thu May 4 11:51:13 2023 -0600
Use GitHub API to get commit count since the last ATS release (#7489)
---
infrastructure/cdn-in-a-box/bin/ats-version.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/infrastructure/cdn-in-a-box/bin/ats-version.sh b/infrastructure/cdn-in-a-box/bin/ats-version.sh
index 9df0c5ff18..4be091c2a8 100755
--- a/infrastructure/cdn-in-a-box/bin/ats-version.sh
+++ b/infrastructure/cdn-in-a-box/bin/ats-version.sh
@@ -19,12 +19,14 @@
trap 'echo "Error on line ${LINENO} of ${0}" >/dev/stderr; exit 1' ERR;
set -o errexit -o nounset -o pipefail
+org=apache
project=trafficserver
script_dir="$(dirname "$0")"
ats_version_file="${script_dir}/../cache/ATS_VERSION"
remote_ats_version() {
- local gitbox_url=https://gitbox.apache.org/repos/asf
+ local gitbox_url=https://gitbox.${org}.org/repos/asf
+ local github_api=https://api.github.com
local repo="${project}.git"
local branch refs commit last_tag release
branch="$(grep 'ATS_VERSION=' "${script_dir}/../../../cache-config/testing/docker/variables.env" | cut -d= -f2)"
@@ -40,8 +42,9 @@ remote_ats_version() {
tail -n1)"
# $release is the number of commits between $release to $branch.
- page_output="$(curl -fs "${gitbox_url}?p=${repo};a=shortlog;h=${branch};hp=${last_tag}")"
- release="$(<<<"$page_output" grep -c 'class="link"' || true)"
+ release="$(curl -fs "${github_api}/repos/${org}/${project}/compare/${last_tag}...${branch}" |
+ grep 'total_commits' |
+ grep -o '[0-9]\+')"
<<<"${last_tag}-${release}.${commit:0:9}" tee "$ats_version_file"
}