@@ -20,6 +20,13 @@ if ! [[ ${BRANCH} == "" ]]; then
2020 git pull
2121fi
2222
23+ # Derive owner/repo slug from origin remote (supports SSH and HTTPS); fallback to rdf4j.
24+ ORIGIN_URL=$( git remote get-url origin 2> /dev/null || true)
25+ REPO_SLUG=$( echo " ${ORIGIN_URL} " | sed -E ' s#.*github.com[:/]+([^/]+/[^/.]+)(\.git)?#\1#' )
26+ if ! [[ " ${REPO_SLUG} " =~ .+/.+ ]]; then
27+ REPO_SLUG=" eclipse-rdf4j/rdf4j"
28+ fi
29+
2330echo " "
2431echo " The script requires several external command line tools:"
2532echo " - git"
@@ -39,7 +46,6 @@ if [ ! -f templates/"${RELEASE_NOTES_TEMPLATE}" ]; then
3946 exit 1;
4047fi
4148
42-
4349if [ ! -f templates/" ${NEWS_ITEM_TEMPLATE} " ]; then
4450 echo " File not found!"
4551 echo " templates/${NEWS_ITEM_TEMPLATE} "
@@ -52,37 +58,53 @@ if [[ ${M} == "" ]]; then
5258 echo " Please make sure that you have cleaned up and closed the milestone connected to ${MVN_VERSION_RELEASE} " ;
5359 read -n 1 -srp " Press any key to continue (ctrl+c to cancel)" ; printf " \n\n" ;
5460
55- SHOULD_BE_NULL_IF_MILESTONE_IS_CLOSED=$( curl -s -H " Accept: application/vnd.github.v3+json" https://api.github.com/repos/eclipse-rdf4j/rdf4j/milestones? state=open | jq ' .[] | select(.title == "' " ${MVN_VERSION_RELEASE} " ' ") | .number' )
61+ SHOULD_BE_NULL_IF_MILESTONE_IS_CLOSED=$(
62+ curl -s -H " Accept: application/vnd.github.v3+json" \
63+ " https://api.github.com/repos/${REPO_SLUG} /milestones?state=open" \
64+ | jq ' .[] | select(.title == "' " ${MVN_VERSION_RELEASE} " ' ") | .number'
65+ )
5666 echo " ${SHOULD_BE_NULL_IF_MILESTONE_IS_CLOSED} "
57- if ! [[ ${SHOULD_BE_NULL_IF_MILESTONE_IS_CLOSED} == " " ]]; then
58- echo " " ;
59- echo " Milestone not closed!" ;
60- echo " https://github.com/eclipse-rdf4j/rdf4j/ milestone/${SHOULD_BE_NULL_IF_MILESTONE_IS_CLOSED} " ;
61- exit 1;
67+ if ! [[ ${SHOULD_BE_NULL_IF_MILESTONE_IS_CLOSED} == " " ]]; then
68+ echo " "
69+ echo " Milestone not closed!"
70+ echo " https://github.com/${REPO_SLUG} / milestone/${SHOULD_BE_NULL_IF_MILESTONE_IS_CLOSED} "
71+ exit 1
6272 fi
6373fi
6474
65- echo " Version: ${MVN_VERSION_RELEASE} " ;
75+ echo " Version: ${MVN_VERSION_RELEASE} "
6676
6777# first try to get the GITHUB_MILESTONE number from the closed milestones
6878export GITHUB_MILESTONE
69- GITHUB_MILESTONE=$( curl -s -H " Accept: application/vnd.github.v3+json" https://api.github.com/repos/eclipse-rdf4j/rdf4j/milestones? state=closed\& direction=desc\& sort=title | jq ' .[] | select(.title == "' " ${MVN_VERSION_RELEASE} " ' ") | .number' )
79+ GITHUB_MILESTONE=$(
80+ curl -s -H " Accept: application/vnd.github.v3+json" \
81+ " https://api.github.com/repos/${REPO_SLUG} /milestones?state=closed&direction=desc&sort=title" \
82+ | jq ' .[] | select(.title == "' " ${MVN_VERSION_RELEASE} " ' ") | .number'
83+ )
7084
7185# then try to get the GITHUB_MILESTONE number from the open milestones (this should only be relevant for RDF4J Milestone builds).
72- if [[ ${GITHUB_MILESTONE} == " " ]]; then
73- GITHUB_MILESTONE=$( curl -s -H " Accept: application/vnd.github.v3+json" https://api.github.com/repos/eclipse-rdf4j/rdf4j/milestones | jq ' .[] | select(.title == "' " ${MVN_VERSION_RELEASE} " ' ") | .number' )
86+ if [[ ${GITHUB_MILESTONE} == " " ]]; then
87+ GITHUB_MILESTONE=$(
88+ curl -s -H " Accept: application/vnd.github.v3+json" \
89+ " https://api.github.com/repos/${REPO_SLUG} /milestones" \
90+ | jq ' .[] | select(.title == "' " ${MVN_VERSION_RELEASE} " ' ") | .number'
91+ )
7492fi
7593
76- if [[ ${GITHUB_MILESTONE} == " " ]]; then
77- echo " " ;
78- echo " Milestone not found matching '${MVN_VERSION_RELEASE} '" ;
79- exit 1;
94+ if [[ ${GITHUB_MILESTONE} == " " ]]; then
95+ echo " "
96+ echo " Milestone not found matching '${MVN_VERSION_RELEASE} '"
97+ exit 1
8098fi
8199
82100export NUMBER_OF_CLOSED_ISSUES
83- NUMBER_OF_CLOSED_ISSUES=$( curl -s -H " Accept: application/vnd.github.v3+json" https://api.github.com/repos/eclipse-rdf4j/rdf4j/milestones/${GITHUB_MILESTONE} | jq ' .closed_issues' )
101+ NUMBER_OF_CLOSED_ISSUES=$(
102+ curl -s -H " Accept: application/vnd.github.v3+json" \
103+ " https://api.github.com/repos/${REPO_SLUG} /milestones/${GITHUB_MILESTONE} " \
104+ | jq ' .closed_issues'
105+ )
84106
85- echo " Milestone: https://github.com/eclipse-rdf4j/rdf4j /milestone/${GITHUB_MILESTONE} "
107+ echo " Milestone: https://github.com/${REPO_SLUG} /milestone/${GITHUB_MILESTONE} "
86108echo " Number of closed issues: ${NUMBER_OF_CLOSED_ISSUES} "
87109
88110export DATETIME
@@ -96,16 +118,22 @@ echo "Collecting assigned contributors for milestone #${GITHUB_MILESTONE}..."
96118# Build a distinct, comma-separated list of assignees as Markdown links.
97119# If a user has a GitHub 'name', use it; otherwise use the username.
98120# Requires: gh (authenticated) and jq (already listed as dependencies above).
121+
122+ # Use explicit GET and querystring to avoid gh defaulting to POST when -f fields are provided.
123+ TMP_ISSUES_JSON=$( mktemp)
124+ if ! gh api -X GET \
125+ " repos/${REPO_SLUG} /issues?milestone=${GITHUB_MILESTONE} &state=all&per_page=100" \
126+ --paginate > " ${TMP_ISSUES_JSON} " ; then
127+ echo " Error: failed to fetch issues for milestone #${GITHUB_MILESTONE} via GitHub CLI."
128+ echo " Tip: run 'gh auth login' and ensure you have access to ${REPO_SLUG} ."
129+ rm -f " ${TMP_ISSUES_JSON} "
130+ exit 1
131+ fi
132+
99133ASSIGNEE_LOGINS=$(
100- gh api -H " Accept: application/vnd.github+json" \
101- repos/eclipse-rdf4j/rdf4j/issues \
102- --paginate \
103- -f milestone=" ${GITHUB_MILESTONE} " \
104- -f state=all \
105- -f per_page=100 \
106- | jq -r ' .[].assignees[]?.login' \
107- | sort -u
134+ jq -r ' .[].assignees[]?.login' " ${TMP_ISSUES_JSON} " | sort -u
108135)
136+ rm -f " ${TMP_ISSUES_JSON} "
109137
110138CONTRIBUTORS_LIST=" "
111139if [[ -n " ${ASSIGNEE_LOGINS} " ]]; then
@@ -136,7 +164,6 @@ echo "Using envsubst to generate content from templates."
136164RELEASE_NOTES=$( cat templates/" ${RELEASE_NOTES_TEMPLATE} " | envsubst)
137165NEWS_ITEM=$( cat templates/" ${NEWS_ITEM_TEMPLATE} " | envsubst)
138166
139-
140167NEWS_FILENAME=${MVN_VERSION_RELEASE_RAW}
141168NEWS_FILENAME=${NEWS_FILENAME/ ./ }
142169NEWS_FILENAME=${NEWS_FILENAME/ ./ }
0 commit comments