File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Label docs PRs for ROS Sync
2+ on :
3+ pull_request :
4+
5+ jobs :
6+ label-docs :
7+ if : contains(github.event.pull_request.title, 'Kilted Sync') || contains(github.event.pull_request.title, 'Jazzy Sync')
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Process docs PRs
11+ env :
12+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13+ run : |
14+ # Determine ROS distro and label from PR title
15+ pr_title="${{ github.event.pull_request.title }}"
16+
17+ if [[ "$pr_title" == *"Kilted Sync"* ]]; then
18+ ros_distro="kilted"
19+ label="backport-kilted"
20+
21+ elif [[ "$pr_title" == *"Jazzy Sync"* ]]; then
22+ ros_distro="jazzy"
23+ label="backport-jazzy"
24+ fi
25+
26+ # Get PR numbers from commits
27+ prs=$(gh api repos/ros-navigation/navigation2/pulls/${{ github.event.number }}/commits \
28+ --jq '.[].commit.message' | grep -o '#[0-9]\+' | tr -d '#' | sort -u)
29+
30+ # Find and label docs PRs
31+ for pr in $prs; do
32+
33+ # Get cross-referenced events
34+ docs_pr=$(gh api repos/ros-navigation/navigation2/issues/$pr/timeline \
35+ --jq '.[] | select(.event == "cross-referenced" and .source.issue.repository.name == "docs.nav2.org") | .source.issue.number' \
36+ 2>/dev/null | head -1)
37+
38+ if [ -n "$docs_pr" ]; then
39+ echo "Labeling docs PR #$docs_pr with '$label'"
40+ gh pr edit $docs_pr --repo ros-navigation/docs.nav2.org --add-label "$label"
41+ else
42+ echo "No cross-referenced docs PR found for navigation2 PR #$pr"
43+ fi
44+ done
You can’t perform that action at this time.
0 commit comments