diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d6215b8ff34..603359da809 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,6 +7,7 @@ | Info | Please fill out this column | | ------ | ----------- | | Ticket(s) this addresses | (add tickets here #1) | +| Documentation | (link to docs PR, pending, or N/A) | | Primary OS tested on | (Ubuntu, MacOS, Windows) | | Robotic platform tested on | (Steve's Robot, gazebo simulation of Tally, hardware turtlebot) | | Does this PR contain AI generated software? | (No; Yes and it is marked inline in the code) | diff --git a/.github/workflows/autotag_docs.yml b/.github/workflows/autotag_docs.yml new file mode 100644 index 00000000000..d301dfabe55 --- /dev/null +++ b/.github/workflows/autotag_docs.yml @@ -0,0 +1,45 @@ +name: Label docs PRs for backports +on: + pull_request: + branches: + - humble + - jazzy + - kilted + +jobs: + label-docs: + runs-on: ubuntu-latest + steps: + - name: Process docs PRs + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Get PR numbers from commits + prs=$(gh api repos/ros-navigation/navigation2/pulls/${{ github.event.number }}/commits \ + --jq '.[].commit.message' | grep -o '#[0-9]\+' | tr -d '#' | sort -u) + + # Find and label docs PRs + docs_pr_found=false + label="backport-${{ github.event.pull_request.base.ref }}" + + for pr in $prs; do + + # Get cross-referenced events + docs_pr=$(gh api repos/ros-navigation/navigation2/issues/$pr/timeline \ + --jq '.[] | select(.event == "cross-referenced" and .source.issue.repository.name == "docs.nav2.org") | .source.issue.number' \ + 2>/dev/null | head -1) + + if [ -n "$docs_pr" ]; then + echo "Labeling docs PR #$docs_pr with '$label'" + gh pr edit $docs_pr --repo ros-navigation/docs.nav2.org --add-label "$label" + docs_pr_found=true + else + echo "No cross-referenced docs PR found for navigation2 PR #$pr" + fi + done + + # Fail if no docs PRs were found + if [ "$docs_pr_found" = false ]; then + echo "ERROR: No docs PRs found for this backport" + exit 1 + fi