Skip to content

Commit 23dffb2

Browse files
Label PRs against target branch, and fail if docs PRs are missing.
Signed-off-by: Leander Stephen D'Souza <[email protected]>
1 parent 1c7df43 commit 23dffb2

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

.github/workflows/autotag_docs.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
1-
name: Label docs PRs for ROS Sync
1+
name: Label docs PRs for backports
22
on:
33
pull_request:
4+
branches:
5+
- humble
6+
- jazzy
7+
- kilted
48

59
jobs:
610
label-docs:
7-
if: contains(github.event.pull_request.title, 'Kilted Sync') || contains(github.event.pull_request.title, 'Jazzy Sync')
811
runs-on: ubuntu-latest
912
steps:
1013
- name: Process docs PRs
1114
env:
12-
GH_TOKEN: ${{ github.token }}
15+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1316
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-
2617
# Get PR numbers from commits
2718
prs=$(gh api repos/ros-navigation/navigation2/pulls/${{ github.event.number }}/commits \
2819
--jq '.[].commit.message' | grep -o '#[0-9]\+' | tr -d '#' | sort -u)
2920
3021
# Find and label docs PRs
22+
docs_pr_found=false
23+
label="backport-${{ github.event.pull_request.base.ref }}"
24+
3125
for pr in $prs; do
3226
3327
# Get cross-referenced events
@@ -38,7 +32,14 @@ jobs:
3832
if [ -n "$docs_pr" ]; then
3933
echo "Labeling docs PR #$docs_pr with '$label'"
4034
gh pr edit $docs_pr --repo ros-navigation/docs.nav2.org --add-label "$label"
35+
docs_pr_found=true
4136
else
4237
echo "No cross-referenced docs PR found for navigation2 PR #$pr"
4338
fi
4439
done
40+
41+
# Fail if no docs PRs were found
42+
if [ "$docs_pr_found" = false ]; then
43+
echo "ERROR: No docs PRs found for this backport"
44+
exit 1
45+
fi

0 commit comments

Comments
 (0)