Skip to content

Commit d832725

Browse files
authored
Merge branch 'main' into amit-e-patch-2
2 parents 48c6e6f + dfcc4df commit d832725

16 files changed

Lines changed: 199 additions & 42 deletions

File tree

.github/workflows/create-translation-batch-pr.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
include:
2828
- language: pt-BR
2929
language_code: pt
30-
# - language: zh-CN
31-
# language_code: cn
32-
# - language: ja-JP
33-
# language_code: ja
34-
# - language: es-ES
35-
# language_code: es
30+
- language: zh-CN
31+
language_code: cn
32+
- language: ja-JP
33+
language_code: ja
34+
- language: es-ES
35+
language_code: es
3636
steps:
3737
- name: Set branch name
3838
id: set-branch
@@ -89,7 +89,7 @@ jobs:
8989

9090
- name: Commit crowdin sync
9191
run: |
92-
git add .
92+
git add translations/${{ matrix.language }}
9393
git commit -m "Add crowdin translations" || echo "Nothing to commit"
9494
9595
- name: 'Setup node'
@@ -102,51 +102,59 @@ jobs:
102102
- name: Reset files with broken liquid tags
103103
run: |
104104
node script/i18n/reset-files-with-broken-liquid-tags.js --language=${{ matrix.language_code }}
105-
git add . && git commit -m "run script/i18n/reset-files-with-broken-liquid-tags.js --language=${{ matrix.language_code }}" || echo "Nothing to commit"
105+
git add translations/${{ matrix.language }} && git commit -m "run script/i18n/reset-files-with-broken-liquid-tags.js --language=${{ matrix.language_code }}" || echo "Nothing to commit"
106106
107107
# step 5 in docs-engineering/crowdin.md using script from docs-internal#22709
108108
- name: Reset known broken files
109109
run: |
110110
node script/i18n/reset-known-broken-translation-files.js
111-
git add . && git commit -m "run script/i18n/reset-known-broken-translation-files.js" || echo "Nothing to commit"
111+
git add translations/${{ matrix.language }} && git commit -m "run script/i18n/reset-known-broken-translation-files.js" || echo "Nothing to commit"
112112
env:
113113
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
114114

115115
# step 6 in docs-engineering/crowdin.md
116116
- name: Homogenize frontmatter
117117
run: |
118118
node script/i18n/homogenize-frontmatter.js
119-
git add . && git commit -m "Run script/i18n/homogenize-frontmatter.js" || echo "Nothing to commit"
119+
git add translations/${{ matrix.language }} && git commit -m "Run script/i18n/homogenize-frontmatter.js" || echo "Nothing to commit"
120120
121121
# step 7 in docs-engineering/crowdin.md
122122
- name: Fix translation errors
123123
run: |
124124
node script/i18n/fix-translation-errors.js
125-
git add . && git commit -m "Run script/i18n/fix-translation-errors.js" || echo "Nothing to commit"
125+
git add translations/${{ matrix.language }} && git commit -m "Run script/i18n/fix-translation-errors.js" || echo "Nothing to commit"
126126
127127
# step 8a in docs-engineering/crowdin.md
128128
- name: Check parsing
129129
run: |
130130
node script/i18n/lint-translation-files.js --check parsing
131-
git add . && git commit -m "Run script/i18n/lint-translation-files.js --check parsing" || echo "Nothing to commit"
131+
git add translations/${{ matrix.language }} && git commit -m "Run script/i18n/lint-translation-files.js --check parsing" || echo "Nothing to commit"
132132
133133
# step 8b in docs-engineering/crowdin.md
134134
- name: Check rendering
135135
run: |
136136
node script/i18n/lint-translation-files.js --check rendering
137-
git add . && git commit -m "Run script/i18n/lint-translation-files.js --check rendering" || echo "Nothing to commit"
137+
git add translations/${{ matrix.language }} && git commit -m "Run script/i18n/lint-translation-files.js --check rendering" || echo "Nothing to commit"
138+
139+
- name: Check in CSV report
140+
run: |
141+
mkdir -p log
142+
csvFile=log/${{ matrix.language_code }}-resets.csv
143+
script/i18n/report-reset-files.js --report-type=csv --language=${{ matrix.language_code }} --log-file=/tmp/batch.log > $csvFile
144+
git add -f $csvFile && git commit -m "Check in ${{ matrix.language }} CSV report" || echo "Nothing to commit"
138145
139146
- name: Create Pull Request
140147
env:
141148
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
142149
# We'll try to create the pull request based on the changes we pushed up in the branch.
143150
# If there are actually no differences between the branch and `main`, we'll delete it.
144151
run: |
152+
script/i18n/report-reset-files.js --report-type=pull-request-body --language=${{ matrix.language_code }} --log-file=/tmp/batch.log > /tmp/pr-body.txt
145153
git push origin ${{ steps.set-branch.outputs.BRANCH_NAME }}
146-
gh pr create -t "New translation batch for ${{ matrix.language }}" \
154+
gh pr create --title "New translation batch for ${{ matrix.language }}" \
147155
--base=main \
148156
--head=${{ steps.set-branch.outputs.BRANCH_NAME }} \
149-
-b "New batch for ${{ matrix.language }} created by [this workflow]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)" || git push origin :${{ steps.set-branch.outputs.BRANCH_NAME }}
157+
--body-file /tmp/pr-body.txt || git push origin :${{ steps.set-branch.outputs.BRANCH_NAME }}
150158
151159
# When the maximum execution time is reached for this job, Actions cancels the workflow run.
152160
# This emits a notification for the first responder to triage.

content/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ Email notifications from {% data variables.product.product_location %} contain t
147147
- There are updates in repositories or team discussions you're watching or in a conversation you're participating in. For more information, see "[About participating and watching notifications](#about-participating-and-watching-notifications)."
148148
- You gain access to a new repository or you've joined a new team. For more information, see "[Automatic watching](#automatic-watching)."{% ifversion fpt or ghes or ghae-issue-4864 or ghec %}
149149
- There are new {% data variables.product.prodname_dependabot_alerts %} in your repository. For more information, see "[{% data variables.product.prodname_dependabot_alerts %} notification options](#dependabot-alerts-notification-options)." {% endif %} {% ifversion fpt or ghec %}
150-
- There are workflow runs updates on repositories set up with {% data variables.product.prodname_actions %}. For more information, see "[{% data variables.product.prodname_actions %} notification options](#github-actions-notification-options)."{% endif %}
150+
- There are workflow runs updates on repositories set up with {% data variables.product.prodname_actions %}. For more information, see "[{% data variables.product.prodname_actions %} notification options](#github-actions-notification-options)."{% endif %}{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5668 %}
151+
- There are new deploy keys added to repositories that belong to organizations that you're an owner of. For more information, see "[Organization alerts notification options](#organization-alerts-notification-options)."{% endif %}
151152

152153
## Automatic watching
153154

@@ -218,6 +219,13 @@ Choose how you want to receive workflow run updates for repositories that you ar
218219

219220
{% endif %}
220221

222+
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5668 %}
223+
## Organization alerts notification options
224+
225+
If you're an organization owner, you'll receive email notifications by default when organization members add new deploy keys to repositories within the organization. You can unsubscribe from these notifications. On the notification settings page, under "Organization alerts", unselect **Email**.
226+
227+
{% endif %}
228+
221229
{% ifversion fpt or ghes or ghec %}
222230
## Managing your notification settings with {% data variables.product.prodname_mobile %}
223231

content/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ To add the {% data variables.product.prodname_dotcom %} OIDC provider to IAM, se
3838

3939
To configure the role and trust in IAM, see the AWS documentation for ["Assuming a Role"](https://github.com/aws-actions/configure-aws-credentials#assuming-a-role) and ["Creating a role for web identity or OpenID connect federation"](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html).
4040

41-
By default, the validation only includes the audience (`aud`) condition, so you must manually add a subject (`sub`) condition. Edit the trust relationship to add the `sub` field to the validation conditions. For example:
41+
Edit the trust relationship to add the `sub` field to the validation conditions. For example:
4242

4343
```json{:copy}
4444
"Condition": {
4545
"StringEquals": {
46-
"token.actions.githubusercontent.com:aud": "https://github.com/octo-org",
4746
"token.actions.githubusercontent.com:sub": "repo:octo-org/octo-repo:ref:refs/heads/octo-branch"
4847
}
4948
}
@@ -86,7 +85,7 @@ env:
8685
# permission can be added at job level or workflow level
8786
permissions:
8887
id-token: write
89-
contents: write # This is required for actions/checkout@v1
88+
contents: read # This is required for actions/checkout@v1
9089
jobs:
9190
S3PackageUpload:
9291
runs-on: ubuntu-latest

content/actions/learn-github-actions/expressions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ if: {% raw %}${{ cancelled() }}{% endraw %}
306306

307307
### failure
308308

309-
Returns `true` when any previous step of a job fails.
309+
Returns `true` when any previous step of a job fails. If you have a chain of dependent jobs, `failure()` returns `true` if any ancestor job fails.
310310

311311
#### Example
312312

content/authentication/keeping-your-account-and-data-secure/reviewing-your-deploy-keys.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ shortTitle: Deploy keys
2323
![Deploy key list](/assets/images/help/settings/settings-deploy-key-review.png)
2424

2525
For more information, see "[Managing deploy keys](/guides/managing-deploy-keys)."
26+
27+
## Further reading
28+
- [Configuring notifications](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#organization-alerts-notification-options)

content/developers/overview/managing-deploy-keys.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,7 @@ This means that you cannot automate the creation of accounts. But if you want to
185185
[collaborator]: /articles/inviting-collaborators-to-a-personal-repository
186186
[outside-collaborator]: /articles/adding-outside-collaborators-to-repositories-in-your-organization
187187
[team]: /articles/adding-organization-members-to-a-team
188+
189+
## Further reading
190+
- [Configuring notifications](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#organization-alerts-notification-options)
191+

middleware/archived-enterprise-versions-assets.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import path from 'path'
2+
3+
import got from 'got'
4+
25
import patterns from '../lib/patterns.js'
36
import isArchivedVersion from '../lib/is-archived-version.js'
4-
import got from 'got'
7+
import { cacheControlFactory } from './cache-control.js'
58

6-
const ONE_DAY = 24 * 60 * 60 // 1 day in seconds
9+
const cacheControl = cacheControlFactory(60 * 60 * 24)
710

811
// This module handles requests for the CSS and JS assets for
912
// deprecated GitHub Enterprise versions by routing them to static content in
@@ -31,7 +34,7 @@ export default async function archivedEnterpriseVersionsAssets(req, res, next) {
3134
res.set('x-is-archived', 'true')
3235
res.set('x-robots-tag', 'noindex')
3336
// Allow the browser and Fastly to cache these
34-
res.set('cache-control', `public, max-age=${ONE_DAY}`)
37+
cacheControl(res)
3538
return res.send(r.body)
3639
} catch (err) {
3740
return next(404)

middleware/archived-enterprise-versions.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ import versionSatisfiesRange from '../lib/version-satisfies-range.js'
99
import isArchivedVersion from '../lib/is-archived-version.js'
1010
import got from 'got'
1111
import readJsonFile from '../lib/read-json-file.js'
12+
import { cacheControlFactory } from './cache-control.js'
1213
const archivedRedirects = readJsonFile(
1314
'./lib/redirects/static/archived-redirects-from-213-to-217.json'
1415
)
1516
const archivedFrontmatterFallbacks = readJsonFile(
1617
'./lib/redirects/static/archived-frontmatter-fallbacks.json'
1718
)
1819

20+
const cacheControl = cacheControlFactory(60 * 60 * 24 * 365)
21+
1922
async function getRemoteJSON(url) {
2023
if (_getRemoteJSONCache.has(url)) {
2124
return _getRemoteJSONCache.get(url)
@@ -42,6 +45,7 @@ export default async function archivedEnterpriseVersions(req, res, next) {
4245
req.path.startsWith('/en/') &&
4346
versionSatisfiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)
4447
) {
48+
cacheControl(res)
4549
return res.redirect(301, req.baseUrl + req.path.replace(/^\/en/, ''))
4650
}
4751

@@ -53,6 +57,7 @@ export default async function archivedEnterpriseVersions(req, res, next) {
5357
) {
5458
const redirect = archivedRedirects[req.path]
5559
if (redirect && redirect !== req.path) {
60+
cacheControl(res)
5661
return res.redirect(301, redirect)
5762
}
5863
}
@@ -64,6 +69,7 @@ export default async function archivedEnterpriseVersions(req, res, next) {
6469
// make redirects found via redirects.json redirect with a 301
6570
if (redirectJson[req.path]) {
6671
res.set('x-robots-tag', 'noindex')
72+
cacheControl(res)
6773
return res.redirect(301, redirectJson[req.path])
6874
}
6975
} catch (err) {
@@ -78,6 +84,7 @@ export default async function archivedEnterpriseVersions(req, res, next) {
7884
// make stubbed redirect files (which exist in versions <2.13) redirect with a 301
7985
const staticRedirect = r.body.match(patterns.staticRedirect)
8086
if (staticRedirect) {
87+
cacheControl(res)
8188
return res.redirect(301, staticRedirect[1])
8289
}
8390

@@ -87,6 +94,7 @@ export default async function archivedEnterpriseVersions(req, res, next) {
8794
for (const fallbackRedirect of getFallbackRedirects(req, requestedVersion) || []) {
8895
try {
8996
await got(getProxyPath(fallbackRedirect, requestedVersion))
97+
cacheControl(res)
9098
return res.redirect(301, fallbackRedirect)
9199
} catch (err) {
92100
// noop

middleware/cache-control.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Return a function you can pass a Response object to and it will
2+
// set the `Cache-Control` header.
3+
//
4+
// For example:
5+
//
6+
// const cacheControlYear = getCacheControl(60 * 60 * 24 * 365)
7+
// ...
8+
// cacheControlYear(res)
9+
// res.send(body)
10+
//
11+
export function cacheControlFactory(maxAge = 60 * 60, public_ = true) {
12+
return (res) => res.set('cache-control', `${public_ ? 'public, ' : ''}max-age=${maxAge}`)
13+
}

script/i18n/fix-translation-errors.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ async function main() {
3333
try {
3434
fileContents = await readFileAsync(path, 'utf8')
3535
} catch (e) {
36-
console.error(e.message)
36+
if (fs.existsSync(path)) {
37+
console.error(e.message)
38+
}
3739
return null
3840
}
3941

0 commit comments

Comments
 (0)