Skip to content

Commit c1db7a3

Browse files
authored
Update PR review auto-comments (#54362)
1 parent bd7faa7 commit c1db7a3

5 files changed

+61
-37
lines changed

.github/workflows/comment-code-changes.yml

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Code changes comment
22

3-
# **What it does**: When a PR is opened in docs-internal or docs containing code, it comments with instructions on how to deploy and preview the changes.
4-
# **Why we have it**: To help Docs contributors understand how to preview their changes.
3+
# **What it does**: When a PR is opened in docs-internal or docs containing code, it comments with instructions on how to deploy and review the changes.
4+
# **Why we have it**: To help Docs contributors understand how to review their changes.
55
# **Who does it impact**: docs-internal and docs maintainers and contributors
66

77
on:
@@ -49,22 +49,29 @@ jobs:
4949
run: |
5050
if [[ "${{ github.repository }}" == "github/docs" ]]; then
5151
COMMENT_BODY="<!-- CODE_CHANGES_COMMENT -->
52-
## 🚀 Manual Deployment Required
52+
### 👓 How to review these changes
5353
54-
It looks like this pull request contains code changes. To preview these changes, an internal Hubber will need to manually deploy the changes to one of our staging servers.
54+
Thank you for your contribution. To review these changes, you can:
5555
56-
Thank you for your contribution!"
56+
1. [Spin up a codespace](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/working-on-github-docs-in-a-codespace)
57+
1. [Set up a local development environment](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment#setting-up-your-local-environment)
58+
59+
This pull request contains code changes, so we will not generate a table of review links. A Hubber will need to deploy your changes internally to review.
60+
61+
🤖 This comment is automatically generated."
5762
else
5863
COMMENT_BODY="<!-- CODE_CHANGES_COMMENT -->
59-
## 🚀 Manual Deployment Required
64+
### 👓 How to review these changes
6065
61-
It looks like this pull request contains code changes. To preview these changes, please do one of:
66+
Thank you for your contribution. To review these changes, you can:
6267
63-
1. [Set up a local development environment](https://github.com/github/docs/blob/main/contributing/development.md).
64-
1. [Spin up a codespace to review](https://github.com/github/docs-engineering/blob/main/docs/team-practices/use-a-codespace-to-review.md).
68+
1. [Spin up a codespace](https://github.com/github/docs-team/blob/main/contributing-to-docs/use-a-codespace-to-review.md).
69+
1. [Set up a local development environment](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment#setting-up-your-local-environment).
6570
1. Message \`#docs-engineering\` on Slack for a staging server.
6671
67-
Thank you for your contribution!"
72+
This pull request contains code changes, so we will not generate a table of review links.
73+
74+
🤖 This comment is automatically generated."
6875
fi
6976
7077
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT_BODY"

.github/workflows/comment-content-changes-table.yml

+32-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Content Changes Table Comment
22

3-
# **What it does**: When a PR is opened in docs-internal or docs, it adds the staging preview and live article links in a Content Directory Changes table in a comment
3+
# **What it does**: When a PR is opened in docs-internal or docs, it adds the staging review and live article links in a Content Directory Changes table in a comment
44
# **Why we have it**: To help Docs Content team members and contributors automatically have their staging/live article links added to the table
55
# **Who does it impact**: docs-internal/docs maintainers and contributors
66

@@ -89,22 +89,30 @@ jobs:
8989
issue-number: ${{ github.event.pull_request.number || inputs.PR_NUMBER }}
9090
body: |
9191
<!-- MODIFIED_CONTENT_LINKING_COMMENT -->
92-
## 👓 Previews for changed content
93-
**This comment is 🤖 automatically generated and will be overwritten every time changes are committed to this branch.**
92+
### 👓 How to review these changes
9493
95-
The table contains an overview of files in the `content` directory that have been changed in this pull request. It's provided to make it easy to review your changes on the review server. Please note that changes to the `data` directory will not show up in this table.
94+
Thank you for your contribution. To review these changes, you can:
9695
97-
:bangbang: You can also preview changes [using Codespaces](https://github.com/github/docs-engineering/blob/main/docs/team-practices/use-a-codespace-to-review.md) or by [spinning up a local environment](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment). Please continue to [let us know](https://github.com/github/docs-team/discussions/4889) if you have trouble with the review server and use one of those options to preview your changes.
96+
1. [Spin up a codespace](https://github.com/github/docs-team/blob/main/contributing-to-docs/use-a-codespace-to-review.md).
97+
1. [Set up a local development environment](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment#setting-up-your-local-environment).
98+
1. Message \`#docs-engineering\` on Slack for a staging server.
9899
99-
---
100+
<details><summary>Table of review links</summary>
101+
102+
> [!WARNING]
103+
> Our review server is experiencing latency issues.
104+
105+
The table shows the files in the `content` directory that were changed in this pull request. This helps you review your changes on the review server. Changes to the `data` directory are not included in this table. If you have issues with the review server, please [let us know](https://github.com/github/docs-team/discussions/4889) and use one of the other options to review your changes.
100106
101-
### Content directory changes
102-
_You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request._
103107
${{ steps.changes.outputs.changesTable }}
104108
105109
---
106110
Key: **fpt**: Free, Pro, Team; **ghec**: GitHub Enterprise Cloud; **ghes**: GitHub Enterprise Server
107111
_This table is posted from the [${{ github.workflow }}](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/comment-content-changes-table.yml) workflow._
112+
113+
</details>
114+
115+
🤖 This comment is automatically generated.
108116
edit-mode: replace
109117

110118
- name: Update comment on docs public
@@ -115,20 +123,29 @@ jobs:
115123
issue-number: ${{ github.event.pull_request.number || inputs.PR_NUMBER }}
116124
body: |
117125
<!-- MODIFIED_CONTENT_LINKING_COMMENT -->
118-
## 👓 Previews for changed content
119-
**This comment is 🤖 automatically generated and will be overwritten every time changes are committed to this branch.**
126+
### 👓 How to review these changes
120127
121-
The table contains an overview of files in the `content` directory that have been changed in this pull request. It's provided to make it easy to review your changes on the review server. Please note that changes to the `data` directory will not show up in this table.
128+
Thank you for your contribution. To review these changes, you can:
122129
123-
:bangbang: You can also preview changes [using Codespaces](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/working-on-github-docs-in-a-codespace) or by [spinning up a local environment](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment). If you have trouble with the review server, use one of those options to preview your changes.
130+
1. [Spin up a codespace](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/working-on-github-docs-in-a-codespace)
131+
1. [Set up a local development environment](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment#setting-up-your-local-environment)
124132
125-
---
133+
A Hubber will need to deploy your changes internally to review.
134+
135+
<details><summary>Table of review links</summary>
136+
137+
> [!WARNING]
138+
> Our review server is experiencing latency issues.
139+
140+
The table shows the files in the `content` directory that were changed in this pull request. This helps you review your changes on the review server. Changes to the `data` directory are not included in this table.
126141
127-
### Content directory changes
128-
_You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request._
129142
${{ steps.changes.outputs.changesTable }}
130143
131144
---
132145
Key: **fpt**: Free, Pro, Team; **ghec**: GitHub Enterprise Cloud; **ghes**: GitHub Enterprise Server
133146
_This table is posted from the [${{ github.workflow }}](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/comment-content-changes-table.yml) workflow._
147+
148+
</details>
149+
150+
🤖 This comment is automatically generated.
134151
edit-mode: replace

.github/workflows/keep-caches-warm.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Keep caches warm
77
# actions cache is warmed up with data available during deployment
88
# actions. When you use actions/cache within a run on `main`
99
# what gets saved can be used by other pull requests. But it's
10-
# also so that when we make preview or production deployments,
10+
# also so that when we make production deployments,
1111
# we can just rely on the cache to already be warmed up.
1212
# **Why we have it**:
1313
# A PR workflow that depends on caching can't reuse a

src/workflows/content-changes-table-comment-cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// To try it you need to generate a local `GITHUB_TOKEN` that has read-access
1414
// "content" and "pull requests" on the repo.
1515
// You also need to set an APP_URL which can be the domain of the
16-
// preview environment or just the production domain. Example:
16+
// review environment or just the production domain. Example:
1717
//
1818
//
1919
// export GITHUB_TOKEN=github_pat_11AAAG.....

src/workflows/content-changes-table-comment.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ async function main(
196196
return ''
197197
}
198198

199-
const headings = ['Source', 'Preview', 'Production', 'What Changed']
199+
const headings = ['Source', 'Review', 'Production', 'What Changed']
200200
const markdownTableHead = [
201201
`| ${headings.map((heading) => `**${heading}**`).join(' | ')} |`,
202202
`| ${headings.map(() => ':---').join(' | ')} |`,
@@ -241,7 +241,7 @@ function makeRow({
241241
fromReusable?: boolean
242242
}) {
243243
let contentCell = ''
244-
let previewCell = ''
244+
let reviewCell = ''
245245
let prodCell = ''
246246

247247
if (file.status === 'added') contentCell = 'New file: '
@@ -269,25 +269,25 @@ function makeRow({
269269
if (versions.toString() === nonEnterpriseDefaultVersion) {
270270
// omit version from fpt url
271271

272-
previewCell += `[${plan}](${APP_URL}/${fileUrl}${queryParams})<br>`
272+
reviewCell += `[${plan}](${APP_URL}/${fileUrl}${queryParams})<br>`
273273
prodCell += `[${plan}](${PROD_URL}/${fileUrl})<br>`
274274
} else {
275275
// for non-versioned releases (ghec) use full url
276276

277-
previewCell += `[${plan}](${APP_URL}/${versions}/${fileUrl}${queryParams})<br>`
277+
reviewCell += `[${plan}](${APP_URL}/${versions}/${fileUrl}${queryParams})<br>`
278278
prodCell += `[${plan}](${PROD_URL}/${versions}/${fileUrl})<br>`
279279
}
280280
} else if (versions.length) {
281281
// for ghes releases, link each version
282282

283-
previewCell += `${plan}@ `
283+
reviewCell += `${plan}@ `
284284
prodCell += `${plan}@ `
285285

286286
versions.forEach((version) => {
287-
previewCell += `[${version.split('@')[1]}](${APP_URL}/${version}/${fileUrl}${queryParams}) `
287+
reviewCell += `[${version.split('@')[1]}](${APP_URL}/${version}/${fileUrl}${queryParams}) `
288288
prodCell += `[${version.split('@')[1]}](${PROD_URL}/${version}/${fileUrl}) `
289289
})
290-
previewCell += '<br>'
290+
reviewCell += '<br>'
291291
prodCell += '<br>'
292292
}
293293
}
@@ -299,14 +299,14 @@ function makeRow({
299299
let note = ''
300300
if (file.status === 'removed') {
301301
note = 'removed'
302-
// If the file was removed, the `previewCell` no longer makes sense
302+
// If the file was removed, the `reviewCell` no longer makes sense
303303
// since it was based on looking at the base sha.
304-
previewCell = 'n/a'
304+
reviewCell = 'n/a'
305305
} else if (fromReusable) {
306306
note += 'from reusable'
307307
}
308308

309-
return `| ${contentCell} | ${previewCell} | ${prodCell} | ${note} |`
309+
return `| ${contentCell} | ${reviewCell} | ${prodCell} | ${note} |`
310310
}
311311

312312
function getAllContentFiles(): Map<string, string> {

0 commit comments

Comments
 (0)