Skip to content

Commit 7837721

Browse files
committed
Merge branch 'script-to-move-toc-links-into-frontmatter' of github.com:github/docs-internal into refactor-site-tree
2 parents cf2d3a0 + 61e2ae9 commit 7837721

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

content/actions/reference/environments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ versions:
1616
You can configure environments with protection rules and secrets. When a workflow job references an environment, the job won't start until all of the environment's protection rules pass. A job also cannot access secrets that are defined in an environment until all the environment protection rules pass.
1717

1818
{% if currentVersion == "free-pro-team@latest" %}
19-
Environment protection rules and environment secrets are only available on public repositories. If you convert a repository from public to private, any configured protection rules or environment secrets will be ignored, and you will not be able to configure any environments. If you convert your repository back to public, you will have access to any previously configured protection rules and environment secrets.
19+
Environment protection rules and environment secrets are only available on public repositories and private repositories on an enterprise plan. If you convert a repository from public to private on a non-enterprise plan, any configured protection rules or environment secrets will be ignored, and you will not be able to configure any environments. If you convert your repository back to public, you will have access to any previously configured protection rules and environment secrets.
2020
{% endif %}
2121

2222
#### Environment protection rules

script/content-migrations/update-tocs.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,16 @@ const indexFiles = fullDirectoryPaths.map(fullDirectoryPath => walk(fullDirector
3434

3535
indexFiles
3636
.forEach(indexFile => {
37-
const relativePath = indexFile.replace(/^.+content\//, '')
37+
const relativePath = indexFile.replace(/^.+\/content\//, '')
3838
const documentType = getDocumentType(relativePath)
3939

4040
const { data, content } = frontmatter(fs.readFileSync(indexFile, 'utf8'))
41-
let newContent = content
4241

4342
if (documentType === 'homepage') {
4443
data.children = sortedProductIds
4544
}
4645

47-
const linkItems = newContent.match(linksArray) || []
46+
const linkItems = content.match(linksArray) || []
4847

4948
// Turn the `{% link /<link> %}` list into an array of /<link> items
5049
if (documentType === 'product' || documentType === 'mapTopic') {
@@ -57,14 +56,6 @@ indexFiles
5756
data.children = childMapTopics.length ? getLinks(childMapTopics) : getLinks(linkItems)
5857
}
5958

60-
linkItems.forEach(linkItem => {
61-
newContent = newContent.replace(linkItem, '').trim()
62-
})
63-
64-
newContent = newContent
65-
.replace(/###? Table of Contents\n/i, '')
66-
.replace(/<!-- {2}-->\n/g, '')
67-
6859
// Fix this one weird file
6960
if (relativePath === 'discussions/guides/index.md') {
7061
data.children = [
@@ -74,7 +65,8 @@ indexFiles
7465
]
7566
}
7667

77-
fs.writeFileSync(indexFile, frontmatter.stringify(newContent.trim(), data, { lineWidth: 10000 }))
68+
// Index files should no longer have body content, so we write an empty string
69+
fs.writeFileSync(indexFile, frontmatter.stringify('', data, { lineWidth: 10000 }))
7870
})
7971

8072
function getLinks (linkItemArray) {

0 commit comments

Comments
 (0)