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