Skip to content

Commit 96a69c9

Browse files
authored
Merge branch 'main' into desktop-git-tags
2 parents 9c38371 + e12b832 commit 96a69c9

15 files changed

Lines changed: 236 additions & 59 deletions

File tree

.github/workflows/triage-unallowed-contributions.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,23 @@ jobs:
7878
with:
7979
github-token: ${{secrets.GITHUB_TOKEN}}
8080
script: |
81-
const changedFiles = ${{steps.filter.outputs.notAllowed_files}}
82-
const restFiles = ${{steps.filter.outputs.openapi_files}}
83-
const translationFiles = ${{steps.filter.outputs.translation_files}}
84-
const markdownFiles = changedFiles.map(file => `- \`${file}\`\n`).join('')
81+
constFilesArr = [
82+
'translations/**',
83+
'lib/rest/static/**',
84+
'.github/workflows/**',
85+
'.github/CODEOWNERS',
86+
'translations/**',
87+
'assets/fonts/**',
88+
'data/graphql/**',
89+
'lib/graphql/**',
90+
'lib/redirects/**',
91+
'lib/rest/**',
92+
'lib/webhooks/**'
93+
]
8594
86-
let reviewMessage = `👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions.\n${markdownFiles}\n\nYou'll need to revert all of these ☝️ files using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:`
95+
const badFiles = badFilesArr.join('\n')
8796
88-
if (restFiles.length > 0) {
89-
reviewMessage += "\n\nIt looks like you've modified the OpenAPI schema (`lib/rest/static/**`). While we aren't accepting changes to the schema directly, you can open an issue for any updates to the REST API docs. Head on over to the [`github/rest-api-description`](https://github.com/github/rest-api-description/issues/new?assignees=&labels=Inaccuracy&template=schema-inaccuracy.md&title=%5BSchema+Inaccuracy%5D+%3CDescribe+Problem%3E) repository to open an issue. ⚡"
90-
}
91-
92-
if (translationFiles.length > 0) {
93-
await github.issues.addLabels({
94-
...context.repo,
95-
issue_number: context.payload.number,
96-
labels: ['localization']
97-
})
98-
reviewMessage += "\n\nIt looks like you've modified translated content. Unfortunately, we are not able to accept pull requests for translated content. Our translation process involves an integration with an external service at crowdin.com, where all translation activity happens. We hope to eventually open up the translation process to the open source community, but we're not there yet. See https://github.com/github/docs/blob/main/CONTRIBUTING.md#earth_asia-translations for more details."
99-
}
97+
let reviewMessage = `👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:\n${badFiles}\n\nYou'll need to revert all of the files you changed in that list using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:`
10098
10199
await github.pulls.createReview({
102100
...context.repo,

content/actions/reference/workflow-syntax-for-github-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ For more information about branch, tag, and path filter syntax, see "[`on.<push|
11991199
| `'**'` | Matches all branch and tag names. This is the default behavior when you don't use a `branches` or `tags` filter. | `all/the/branches`<br/><br/>`every/tag` |
12001200
| `'*feature'` | The `*` character is a special character in YAML. When you start a pattern with `*`, you must use quotes. | `mona-feature`<br/><br/>`feature`<br/><br/>`ver-10-feature` |
12011201
| `v2*` | Matches branch and tag names that start with `v2`. | `v2`<br/><br/>`v2.0`<br/><br/>`v2.9` |
1202-
| `v[12].[0-9]+.[0-9]+` | Matches all semantic versioning tags with major version 1 or 2 | `v1.10.1`<br/><br/>`v2.0.0` |
1202+
| `v[12].[0-9]+.[0-9]+` | Matches all semantic versioning branches and tags with major version 1 or 2 | `v1.10.1`<br/><br/>`v2.0.0` |
12031203

12041204
#### Patterns to match file paths
12051205

content/github/administering-a-repository/about-dependabot-version-updates.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ versions:
1515

1616
{% data variables.product.prodname_dependabot %} takes the effort out of maintaining your dependencies. You can use it to ensure that your repository automatically keeps up with the latest releases of the packages and applications it depends on.
1717

18-
You enable {% data variables.product.prodname_dependabot_version_updates %} by checking a configuration file in to your repository. The configuration file specifies the location of the manifest, or other package definition files, stored in your repository. {% data variables.product.prodname_dependabot %} uses this information to check for outdated packages and applications. {% data variables.product.prodname_dependabot %} determines if there is a new version of a dependency by looking at the semantic versioning ([semver](https://semver.org/)) of the dependency to decide whether it should update to that version. For certain package managers, {% data variables.product.prodname_dependabot_version_updates %} also supports vendoring. Vendored (or cached) dependencies are dependencies that are checked in to a specific directory in a repository, rather than referenced in a manifest. Vendored dependencies are available at build time even if package servers are unavailable. {% data variables.product.prodname_dependabot_version_updates %} can be configured to check vendored dependencies for new versions and update them if necessary.
18+
You enable {% data variables.product.prodname_dependabot_version_updates %} by checking a configuration file into your repository. The configuration file specifies the location of the manifest, or of other package definition files, stored in your repository. {% data variables.product.prodname_dependabot %} uses this information to check for outdated packages and applications. {% data variables.product.prodname_dependabot %} determines if there is a new version of a dependency by looking at the semantic versioning ([semver](https://semver.org/)) of the dependency to decide whether it should update to that version. For certain package managers, {% data variables.product.prodname_dependabot_version_updates %} also supports vendoring. Vendored (or cached) dependencies are dependencies that are checked in to a specific directory in a repository rather than referenced in a manifest. Vendored dependencies are available at build time even if package servers are unavailable. {% data variables.product.prodname_dependabot_version_updates %} can be configured to check vendored dependencies for new versions and update them if necessary.
1919

20-
When {% data variables.product.prodname_dependabot %} identifies an outdated dependency, it raises a pull request to update the manifest to the latest version of the dependency. For vendored dependencies, {% data variables.product.prodname_dependabot %} raises a pull request to directly replace the outdated dependency with the new version. You check that your tests pass, review the changelog and release notes included in the pull request summary, and then merge it. For more information, see "[Enabling and disabling version updates](/github/administering-a-repository/enabling-and-disabling-version-updates)."
20+
When {% data variables.product.prodname_dependabot %} identifies an outdated dependency, it raises a pull request to update the manifest to the latest version of the dependency. For vendored dependencies, {% data variables.product.prodname_dependabot %} raises a pull request to replace the outdated dependency with the new version directly. You check that your tests pass, review the changelog and release notes included in the pull request summary, and then merge it. For more information, see "[Enabling and disabling version updates](/github/administering-a-repository/enabling-and-disabling-version-updates)."
2121

2222
If you enable security updates, {% data variables.product.prodname_dependabot %} also raises pull requests to update vulnerable dependencies. For more information, see "[About {% data variables.product.prodname_dependabot_security_updates %}](/github/managing-security-vulnerabilities/about-dependabot-security-updates)."
2323

data/release-notes/3-0/0-rc1.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
date: '2021-01-12'
22
release_candidate: true
3-
intro: Release notes are now published on the documentation site. The new location makes it easier to learn about new releases and features at the same time. Historical release notes are available on [GitHub Enterprise Releases](https://enterprise.github.com/releases).
3+
intro: Release candidate versions should be tested on non-production environments. For more information about the Release Candidate Program, see the [GitHub Blog](https://github.blog/2020-12-03-improving-the-ghes-release-process-release-candidates/) or "[About upgrades to new releases](/admin/overview/about-upgrades-to-new-releases)".
44
sections:
55
features:
66
- heading: GitHub Actions

data/release-notes/3-0/0-rc2.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
date: '2021-01-29'
2+
release_candidate: true
3+
intro: Release candidate versions should be tested on non-production environments. For more information about the Release Candidate Program, see the [GitHub Blog](https://github.blog/2020-12-03-improving-the-ghes-release-process-release-candidates/) or "[About upgrades to new releases](/admin/overview/about-upgrades-to-new-releases)."
4+
sections:
5+
bugs:
6+
- heading: Fixes for known issues from Release Candidate 1
7+
notes:
8+
- If you disabled GitHub Actions following an unsuccessful attempt to set up GitHub Actions, then you will not be able to create the first user and use the appliance.
9+
- The "Mandatory message viewed" audit log event was not being saved.
10+
- '`ghe-config-apply` needed to run on a replica during an initial setup before `ghe-repl-setup` could run to start replication.'
11+
- Removing yourself as an enterprise owner returned a 404.
12+
- heading: Fixes for other issues
13+
notes:
14+
- Issues with migrations and upgrades to 3.0.0 have been fixed.
15+
- Backup Utilities versioning now works for release candidate versions.
16+
- Generating a support bundle resulted in an error in the orchestrator logs.
17+
- A large restore could result in Redis running out of memory.
18+
- The checkbox to enable GitHub Actions in the Management Console is now visible with any authentication method.
19+
- GitHub Actions can only be enabled if the required storage is also configured.
20+
- '`ghe-repl-status` could silently fail if MSSQL replication is not configured.'
21+
22+
known_issues:
23+
- The known issues for Release Candidate 1 still apply, excluding the bug fixes listed.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Key | Type | Description
22
----|------|-------------
3-
`action`|`string` | The action that was performed. Can be one of `opened`, `edited`, `closed`, `assigned`, `unassigned`, `review_requested`, `review_request_removed`, `ready_for_review`, `labeled`, `unlabeled`, `synchronize`, `locked`, `unlocked`, or `reopened`. If the action is `closed` and the `merged` key is `false`, the pull request was closed with unmerged commits. If the action is `closed` and the `merged` key is `true`, the pull request was merged.
3+
`action`|`string` | The action that was performed. Can be one of `opened`, `edited`, `closed`, `assigned`, `unassigned`, `review_requested`, `review_request_removed`, `ready_for_review`, `converted_to_draft`, `labeled`, `unlabeled`, `synchronize`, `locked`, `unlocked`, or `reopened`. If the action is `closed` and the `merged` key is `false`, the pull request was closed with unmerged commits. If the action is `closed` and the `merged` key is `true`, the pull request was merged.

lib/page.js

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ const path = require('path')
44
const cheerio = require('cheerio')
55
const patterns = require('./patterns')
66
const getMapTopicContent = require('./get-map-topic-content')
7-
const rewriteAssetPathsToS3 = require('./rewrite-asset-paths-to-s3')
87
const getApplicableVersions = require('./get-applicable-versions')
98
const encodeBracketedParentheses = require('./encode-bracketed-parentheses')
109
const generateRedirectsForPermalinks = require('./redirects/permalinks')
1110
const getEnglishHeadings = require('./get-english-headings')
12-
const useEnglishHeadings = require('./use-english-headings')
1311
const getTocItems = require('./get-toc-items')
1412
const pathUtils = require('./path-utils')
1513
const Permalink = require('./permalink')
@@ -154,6 +152,12 @@ class Page {
154152
this.markdown = await this.getMarkdown()
155153
}
156154

155+
// use English IDs/anchors for translated headings, so links don't break (see #8572)
156+
if (this.languageCode !== 'en') {
157+
const englishHeadings = getEnglishHeadings(this, context.pages)
158+
context.englishHeadings = englishHeadings
159+
}
160+
157161
this.intro = await renderContent(this.rawIntro, context)
158162
this.introPlainText = await renderContent(this.rawIntro, context, { textOnly: true })
159163
this.title = await renderContent(this.rawTitle, context, { textOnly: true, encodeEntities: true })
@@ -185,6 +189,7 @@ class Page {
185189
}))
186190
}
187191

192+
context.relativePath = this.relativePath
188193
const html = await renderContent(markdown, context)
189194

190195
// product frontmatter may contain liquid
@@ -227,29 +232,14 @@ class Page {
227232
})
228233
}
229234

230-
const $ = cheerio.load(html)
231-
232235
// set a flag so layout knows whether to render a mac/windows/linux switcher element
233-
this.includesPlatformSpecificContent = $('[class^="platform-"], .mac, .windows, .linux').length > 0
234-
235-
// rewrite asset paths to s3 if it's a dotcom article on any GHE version
236-
// or if it's an enterprise article on any GHE version EXCEPT latest version
237-
rewriteAssetPathsToS3($, context.currentVersion, this.relativePath)
238-
239-
// use English IDs/anchors for translated headings, so links don't break (see #8572)
240-
if (this.languageCode !== 'en') {
241-
const englishHeadings = getEnglishHeadings(this, context.pages)
242-
if (englishHeadings) useEnglishHeadings($, englishHeadings)
243-
}
244-
245-
// wrap ordered list images in a container div
246-
$('ol > li img').each((i, el) => {
247-
$(el).wrap('<div class="procedural-image-wrapper" />')
248-
})
249-
250-
const cleanedHTML = $('body').html()
236+
this.includesPlatformSpecificContent = (
237+
html.includes('extended-markdown mac') ||
238+
html.includes('extended-markdown windows') ||
239+
html.includes('extended-markdown linux')
240+
)
251241

252-
return cleanedHTML
242+
return html
253243
}
254244

255245
// Allow other modules (like custom liquid tags) to make one-off requests

lib/render-content/create-processor.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const graphql = require('highlightjs-graphql').definer
1111
const remarkCodeExtra = require('remark-code-extra')
1212
const codeHeader = require('./plugins/code-header')
1313
const rewriteLocalLinks = require('./plugins/rewrite-local-links')
14+
const useEnglishHeadings = require('./plugins/use-english-headings')
15+
const rewriteAssetPathsToS3 = require('./plugins/rewrite-asset-paths-to-s3')
16+
const wrapInElement = require('./plugins/wrap-in-element')
1417

1518
module.exports = function createProcessor (context) {
1619
return unified()
@@ -19,9 +22,12 @@ module.exports = function createProcessor (context) {
1922
.use(emoji)
2023
.use(remark2rehype, { allowDangerousHTML: true })
2124
.use(slug)
25+
.use(useEnglishHeadings, context)
2226
.use(autolinkHeadings, { behavior: 'wrap' })
2327
.use(highlight, { languages: { graphql }, subset: false })
2428
.use(raw)
29+
.use(rewriteAssetPathsToS3, context)
30+
.use(wrapInElement, { selector: 'ol > li img', wrapper: 'div.procedural-image-wrapper' })
2531
.use(rewriteLocalLinks, { languageCode: context.currentLanguage, version: context.currentVersion })
2632
.use(html)
2733
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const visit = require('unist-util-visit')
2+
const latestEnterpriseRelease = require('../../enterprise-server-releases').latest
3+
const nonEnterpriseDefaultVersion = require('../../non-enterprise-default-version')
4+
const { getS3BucketPathFromVersion } = require('../../s3-bucket-path-utils')
5+
const allVersions = require('../../all-versions')
6+
const s3BasePath = 'https://github-images.s3.amazonaws.com'
7+
8+
const matcher = node => (
9+
node.type === 'element' &&
10+
node.tagName === 'img' &&
11+
node.properties.src &&
12+
node.properties.src.startsWith('/assets/images')
13+
)
14+
15+
// This module rewrites asset paths on Enterprise versions to S3 paths.
16+
// Source example: /assets/images/foo.png
17+
// Rewritten: https://github-images.s3.amazonaws.com/enterprise/2.20/assets/images/foo.png
18+
// The one exception is Admin pages on the latest GHES release.
19+
module.exports = function rewriteAssetPathsToS3 ({ currentVersion, relativePath }) {
20+
// Bail if we don't have a relativePath in this context
21+
if (!relativePath) return
22+
23+
// skip if this is the homepage
24+
if (relativePath === 'index.md') return
25+
26+
// if the current version is non-enterprise, do not rewrite
27+
if (currentVersion === nonEnterpriseDefaultVersion) return
28+
29+
// the relativePath starts with the product, like /admin/foo or /github/foo
30+
const product = relativePath.split('/')[0]
31+
32+
// if this is an Admin page on the latest GHES release, do not rewrite
33+
if (product === 'admin' && allVersions[currentVersion].currentRelease === latestEnterpriseRelease) return
34+
35+
// if the version is enterprise-server@2.22, use `enterprise/2.22` as the bucket path
36+
// otherwise, use the plan name, e.g., `github-ae`
37+
const bucketPath = getS3BucketPathFromVersion(currentVersion)
38+
39+
return tree => {
40+
visit(tree, matcher, node => {
41+
// Rewrite the node's src
42+
node.properties.src = `${s3BasePath}/${bucketPath}${node.properties.src}`
43+
})
44+
}
45+
}

lib/render-content/plugins/rewrite-local-links.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ module.exports = function rewriteLocalLinks ({ languageCode, version }) {
2626
// There's no languageCode or version passed, so nothing to do
2727
if (!languageCode || !version) return
2828

29-
return ast => {
30-
visit(ast, matcher, node => {
29+
return tree => {
30+
visit(tree, matcher, node => {
3131
const newHref = getNewHref(node, languageCode, version)
3232
if (newHref) {
3333
node.properties.href = newHref

0 commit comments

Comments
 (0)