Enhance publish-docs workflow: Include triggering upstream PR details in autogenerated docs PRs#11159
Enhance publish-docs workflow: Include triggering upstream PR details in autogenerated docs PRs#11159
Conversation
Co-authored-by: willtsai <28876888+willtsai@users.noreply.github.com>
Co-authored-by: willtsai <28876888+willtsai@users.noreply.github.com>
…ation Co-authored-by: willtsai <28876888+willtsai@users.noreply.github.com>
Co-authored-by: willtsai <28876888+willtsai@users.noreply.github.com>
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
There was a problem hiding this comment.
Pull request overview
Updates the publish-docs GitHub Actions workflow so autogenerated PRs to the docs repo include richer context about what triggered the docs generation (merged PR vs direct commit vs manual dispatch), improving traceability back to Radius changes.
Changes:
- Add a workflow step to infer trigger context from the triggering commit message and build a formatted PR title/body.
- Use the generated title/body outputs when creating the docs pull request.
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT | ||
| echo "**Commit:** [\`${{ github.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_OUTPUT | ||
| echo "**Author:** $COMMIT_AUTHOR" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
| else | ||
| # Regular push commit (not from a PR merge) | ||
| echo "pr-title=Update auto-generated documentation (${GITHUB_REF##*/})" >> $GITHUB_OUTPUT | ||
| echo "pr-body<<EOF" >> $GITHUB_OUTPUT | ||
| echo "## Autogenerated PR" >> $GITHUB_OUTPUT | ||
| echo "" >> $GITHUB_OUTPUT | ||
| echo "This PR updates the auto-generated reference documentation." >> $GITHUB_OUTPUT | ||
| echo "" >> $GITHUB_OUTPUT | ||
| echo "### Triggered by" >> $GITHUB_OUTPUT | ||
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
${GITHUB_REF##*/} only keeps the last path segment, so for branches like release/0.32 this will render as 0.32. Use ${{ github.ref_name }} (preferred) or strip only the refs/heads/ prefix so the full branch name is preserved in the generated PR body.
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT | |
| echo "**Commit:** [\`${{ github.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_OUTPUT | |
| echo "**Author:** $COMMIT_AUTHOR" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| else | |
| # Regular push commit (not from a PR merge) | |
| echo "pr-title=Update auto-generated documentation (${GITHUB_REF##*/})" >> $GITHUB_OUTPUT | |
| echo "pr-body<<EOF" >> $GITHUB_OUTPUT | |
| echo "## Autogenerated PR" >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "This PR updates the auto-generated reference documentation." >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "### Triggered by" >> $GITHUB_OUTPUT | |
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT | |
| echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_OUTPUT | |
| echo "**Commit:** [\`${{ github.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_OUTPUT | |
| echo "**Author:** $COMMIT_AUTHOR" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| else | |
| # Regular push commit (not from a PR merge) | |
| echo "pr-title=Update auto-generated documentation (${{ github.ref_name }})" >> $GITHUB_OUTPUT | |
| echo "pr-body<<EOF" >> $GITHUB_OUTPUT | |
| echo "## Autogenerated PR" >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "This PR updates the auto-generated reference documentation." >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "### Triggered by" >> $GITHUB_OUTPUT | |
| echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_OUTPUT |
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT | ||
| echo "**Commit:** [\`${{ github.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_OUTPUT | ||
| echo "**Author:** $COMMIT_AUTHOR" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
| else | ||
| # Regular push commit (not from a PR merge) | ||
| echo "pr-title=Update auto-generated documentation (${GITHUB_REF##*/})" >> $GITHUB_OUTPUT | ||
| echo "pr-body<<EOF" >> $GITHUB_OUTPUT | ||
| echo "## Autogenerated PR" >> $GITHUB_OUTPUT | ||
| echo "" >> $GITHUB_OUTPUT | ||
| echo "This PR updates the auto-generated reference documentation." >> $GITHUB_OUTPUT | ||
| echo "" >> $GITHUB_OUTPUT | ||
| echo "### Triggered by" >> $GITHUB_OUTPUT | ||
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
${GITHUB_REF##*/} truncates branch names containing slashes (e.g., release/0.32 becomes 0.32), which can make the autogenerated PR title misleading. Prefer ${{ github.ref_name }} or a safer prefix strip (${GITHUB_REF#refs/heads/}).
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT | |
| echo "**Commit:** [\`${{ github.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_OUTPUT | |
| echo "**Author:** $COMMIT_AUTHOR" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| else | |
| # Regular push commit (not from a PR merge) | |
| echo "pr-title=Update auto-generated documentation (${GITHUB_REF##*/})" >> $GITHUB_OUTPUT | |
| echo "pr-body<<EOF" >> $GITHUB_OUTPUT | |
| echo "## Autogenerated PR" >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "This PR updates the auto-generated reference documentation." >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "### Triggered by" >> $GITHUB_OUTPUT | |
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT | |
| echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_OUTPUT | |
| echo "**Commit:** [\`${{ github.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_OUTPUT | |
| echo "**Author:** $COMMIT_AUTHOR" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| else | |
| # Regular push commit (not from a PR merge) | |
| echo "pr-title=Update auto-generated documentation (${{ github.ref_name }})" >> $GITHUB_OUTPUT | |
| echo "pr-body<<EOF" >> $GITHUB_OUTPUT | |
| echo "## Autogenerated PR" >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "This PR updates the auto-generated reference documentation." >> $GITHUB_OUTPUT | |
| echo "" >> $GITHUB_OUTPUT | |
| echo "### Triggered by" >> $GITHUB_OUTPUT | |
| echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_OUTPUT |
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT | ||
| echo "**Commit:** [\`${{ github.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
${GITHUB_REF##*/} drops everything before the last /, so the docs PR will show the wrong branch for release/* pushes. Use ${{ github.ref_name }} or ${GITHUB_REF#refs/heads/} to keep release/<version> intact.
| - name: Prepare PR context | ||
| id: pr-context | ||
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.open_pull_request == 'true') | ||
| run: | | ||
| # Change to radius directory to extract commit information |
There was a problem hiding this comment.
The trigger-detection/formatting logic here is fairly large and hard to test outside CI. Consider moving it into a versioned script under radius/.github/scripts/ (invoked from the workflow) so it can be run locally and keeps the workflow YAML focused on orchestration.
| echo "### Triggered by" >> $GITHUB_OUTPUT | ||
| echo "**Trigger:** Manual workflow dispatch" >> $GITHUB_OUTPUT | ||
| echo "**Triggered by:** @${{ github.actor }}" >> $GITHUB_OUTPUT | ||
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
${GITHUB_REF##*/} truncates branch names that include / (e.g., release/0.32). Use ${{ github.ref_name }} (preferred) or ${GITHUB_REF#refs/heads/} so the manual-trigger PR body shows the full branch name.
| echo "**Branch:** \`${GITHUB_REF##*/}\`" >> $GITHUB_OUTPUT | |
| echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_OUTPUT |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11159 +/- ##
==========================================
- Coverage 51.10% 51.09% -0.01%
==========================================
Files 699 699
Lines 44067 44067
==========================================
- Hits 22519 22517 -2
- Misses 19401 19402 +1
- Partials 2147 2148 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
The
publish-docsworkflow generates PRs against the docs repository without context about the triggering upstream change. This makes it difficult for reviewers to trace documentation updates back to source code changes.Changes
Added context extraction step that detects trigger type and formats rich PR descriptions:
Merged PRs - Extracts PR number and title from squash merge commit messages using pattern
\(#([0-9]+)\)$Update auto-generated documentation (PR #1234)Direct commits - Captures commit metadata for non-PR changes
Update auto-generated documentation (main)Manual triggers - Identifies workflow_dispatch invocations
Update auto-generated documentation (manual trigger)Implementation: Pure bash/git pattern matching. No API calls, no additional permissions required.
Before
After
Type of change
Contributor checklist
Please verify that the PR meets the following requirements, where applicable:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.