Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions release-collection/milestones/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# README

This directory contains tools and data to create milestones on all Gazebo
libraries as it is not currently possible to share a milestone between different
Github repositories. Instead, we create a milestone with the same name on all
the repos and use queries like
[`milestone:"Jetty Release"`](https://github.com/search?q=org%3Agazebosim+milestone%3A%22Jetty+Release%22&type=pullrequests)
to filter pull request/issues. This is typically done during preparation for the
release of a collection (e.g. Gazebo Jetty).

Usage:

1. Install and configure the Github CLI tool [`gh`](https://cli.github.com/).
Ensure you have write permission on all the Gazebo library repos.

1. Create a `json` file with the following format replacing `<collection>` and
`<due date>`.

```json
{
"title": "<collection> Release",
"state": "open",
"description": "Track pull requests that are meant to go into the release. Note that this also includes pull requests that get merged into older branches and get forward merged.",
"due_on": "<due date>"
}
```

1. Run `create_milestones.bash` with the file created above as an argument.
74 changes: 74 additions & 0 deletions release-collection/milestones/create_milestones.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash
# Copyright (C) 2025 Open Source Robotics Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This script creates milestones in each Gazebo library and ros_gz. You'll
# need the `gh` Github CLI tool installed and configured properly with an
# account that has write permissions on all the repos specified below.
#
# Usage:
# ./create_milestones.bash milestone_description.json
#
# where milestone_description.json is json file that contains the title,
# description and due date of the milestone
# Example:
#
# {
# "title": "Jetty Release"
# "state": "open",
# "description": "Track pull requests that are meant to go into the release. Note that this also includes pull requests that get merged into older branches and get forward merged."
# "due_on": "2025-09-29T23:59:59Z"
# }
#
#
if [[ $# -lt 1 ]]; then
echo "./create_milestones.bash FILE.json"
exit 1
fi

if [[ ! -f $1 ]]; then
echo "File \"$1\" does not exist"
exit 1
fi

repos="
gz-cmake
gz-common
gz-fuel-tools
gz-gui
gz-launch
gz-math
gz-msgs
gz-physics
gz-plugin
gz-rendering
gz-sensors
gz-sim
gz-tools
gz-transport
gz-utils
sdformat
ros_gz
"

for repo in $repos; do
echo "Creating milestone on gazebosim/$repo"
result=$(cat $1 | gh api --jq ".html_url" --method POST repos/gazebosim/$repo/milestones --input - 2>&1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 68-73 lines are a bit over-complex to my eyes probably with some bugs like the use of retval instead of $retval in line 71. Can not try this easily but I would write something like:

--- a/release-collection/milestones/create_milestones.bash
+++ b/release-collection/milestones/create_milestones.bash
@@ -65,10 +65,11 @@ ros_gz
 
 for repo in $repos; do
   echo "Creating milestone on gazebosim/$repo"
-  result=$(cat $1 | gh api  --jq ".html_url" --method POST repos/gazebosim/$repo/milestones --input - 2>&1)
-  retval=$?
-  echo "  url: $result"
-  if [[ retval -ne 0 ]]; then
+  result=$(gh api --jq ".html_url" --method POST "repos/gazebosim/$repo/milestones" --input "$1" 2>&1)
+  if [[ $? -eq 0 ]]; then
+    echo "  url: $result"
+  else
+    echo "Error: $result" >&2
     exit 1
   fi
 done

retval=$?
echo " url: $result"
if [[ retval -ne 0 ]]; then
exit 1
fi
done
6 changes: 6 additions & 0 deletions release-collection/milestones/jetty_release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"title": "Jetty Release",
"state": "open",
"description": "Track pull requests that are meant to go into the release. Note that this also includes pull requests that get merged into older branches and get forward merged.",
"due_on": "2025-09-29T23:59:59Z"
}