|
91 | 91 | fi |
92 | 92 |
|
93 | 93 | - name: Run content pipeline update script |
| 94 | + id: update |
94 | 95 | env: |
95 | 96 | GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }} |
96 | 97 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
@@ -133,27 +134,48 @@ jobs: |
133 | 134 | GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }} |
134 | 135 | UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }} |
135 | 136 | PIPELINE_ID: ${{ matrix.id }} |
| 137 | + COMPARE_URL: ${{ steps.update.outputs.compare_url }} |
| 138 | + SHORT_RANGE: ${{ steps.update.outputs.short_range }} |
136 | 139 | run: | |
137 | 140 | PR_NUMBER="${{ steps.check-pr.outputs.pr_number }}" |
138 | 141 | PR_TITLE="docs: update ${PIPELINE_ID} content from source docs" |
139 | | -
|
140 | | - PR_BODY="_GitHub Copilot generated this pull request._"$'\n\n' |
141 | | - PR_BODY+="> [!NOTE]"$'\n' |
142 | | - PR_BODY+="> This PR is **automatically generated** by the [content pipeline update workflow](${{ github.server_url }}/${{ github.repository }}/actions/workflows/content-pipelines.yml). Each run adds a new commit with any documentation changes detected."$'\n\n' |
143 | | - PR_BODY+="## What this does"$'\n\n' |
144 | | - PR_BODY+="Runs the \`content-pipeline-update\` agent (${PIPELINE_ID}) against the latest source docs and updates official articles under \`content/\` that have fallen out of sync."$'\n\n' |
145 | | - PR_BODY+="## Review"$'\n\n' |
146 | | - PR_BODY+="* Review each commit for accuracy — the agent uses AI, so spot-check important changes"$'\n' |
147 | | - PR_BODY+="* To adjust agent behavior, see [Modifying results](${{ github.server_url }}/${{ github.repository }}/blob/main/src/content-pipelines/README.md#modifying-results)"$'\n' |
148 | | - PR_BODY+="* Once satisfied, merge to keep docs up to date"$'\n' |
149 | | - PR_BODY+="* A new PR will be created on the next run if there are further changes" |
| 142 | + NEW_ITEM="* [\`${SHORT_RANGE}\`](${COMPARE_URL})" |
150 | 143 |
|
151 | 144 | if [ -n "$PR_NUMBER" ]; then |
152 | | - echo "PR #$PR_NUMBER already exists — new commit pushed" |
| 145 | + echo "PR #$PR_NUMBER already exists — appending source changes to body" |
| 146 | +
|
| 147 | + EXISTING_BODY=$(gh pr view "$PR_NUMBER" --json body --jq '.body') |
| 148 | +
|
| 149 | + # Append a new bullet before the SOURCE_CHANGES end marker |
| 150 | + # Uses bash parameter expansion for safe literal string replacement |
| 151 | + MARKER="<!-- /SOURCE_CHANGES -->" |
| 152 | + INSERTION="${NEW_ITEM}"$'\n' |
| 153 | + INSERTION+="${MARKER}" |
| 154 | + UPDATED_BODY="${EXISTING_BODY/$MARKER/$INSERTION}" |
| 155 | +
|
| 156 | + gh pr edit "$PR_NUMBER" --body "$UPDATED_BODY" |
| 157 | +
|
153 | 158 | echo "Ensuring PR #$PR_NUMBER is marked ready for review" |
154 | 159 | gh pr ready "$PR_NUMBER" || echo "Unable to mark PR #$PR_NUMBER as ready (it may already be ready)" |
155 | 160 | else |
156 | 161 | echo "Creating new PR" |
| 162 | +
|
| 163 | + PR_BODY="_GitHub Copilot generated this pull request._"$'\n\n' |
| 164 | + PR_BODY+="> [!NOTE]"$'\n' |
| 165 | + PR_BODY+="> This PR is **automatically generated** by the [content pipeline update workflow](${{ github.server_url }}/${{ github.repository }}/actions/workflows/content-pipelines.yml). Each run adds a new commit with any documentation changes detected."$'\n\n' |
| 166 | + PR_BODY+="## What this does"$'\n\n' |
| 167 | + PR_BODY+="Runs the \`content-pipeline-update\` agent (${PIPELINE_ID}) against the latest source docs and updates official articles under \`content/\` that have fallen out of sync."$'\n\n' |
| 168 | + PR_BODY+="## Source changes"$'\n\n' |
| 169 | + PR_BODY+="Changes in the source repo that triggered this update:"$'\n\n' |
| 170 | + PR_BODY+="<!-- SOURCE_CHANGES -->"$'\n' |
| 171 | + PR_BODY+="${NEW_ITEM}"$'\n' |
| 172 | + PR_BODY+="<!-- /SOURCE_CHANGES -->"$'\n\n' |
| 173 | + PR_BODY+="## Review"$'\n\n' |
| 174 | + PR_BODY+="* Review each commit for accuracy — the agent uses AI, so spot-check important changes"$'\n' |
| 175 | + PR_BODY+="* To adjust agent behavior, see [Modifying results](${{ github.server_url }}/${{ github.repository }}/blob/main/src/content-pipelines/README.md#modifying-results)"$'\n' |
| 176 | + PR_BODY+="* Once satisfied, merge to keep docs up to date"$'\n' |
| 177 | + PR_BODY+="* A new PR will be created on the next run if there are further changes" |
| 178 | +
|
157 | 179 | gh pr create \ |
158 | 180 | --title "$PR_TITLE" \ |
159 | 181 | --body "$PR_BODY" \ |
|
0 commit comments