Skip to content

Commit 47a4616

Browse files
committed
Merge branch 'main' of github.com:github/docs-internal into refactor-site-tree
2 parents 0eebfc4 + 3276517 commit 47a4616

18 files changed

Lines changed: 176 additions & 130 deletions

File tree

.github/allowed-actions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = [
2727
"juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9",
2828
"juliangruber/read-file-action@e0a316da496006ffd19142f0fd594a1783f3b512",
2929
"lee-dohm/close-matching-issues@22002609b2555fe18f52b8e2e7c07cbf5529e8a8",
30+
"lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb",
3031
"pascalgn/automerge-action@c9bd1823770819dc8fb8a5db2d11a3a95fbe9b07", //pascalgn/automerge@0.12.0
3132
"peter-evans/create-issue-from-file@a04ce672e3acedb1f8e416b46716ddfd09905326",
3233
"peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd",

.github/workflows/no-response.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: No Response
2+
3+
# **What it does**: Closes issues that don't have enough information to be
4+
# actionable.
5+
# **Why we have it**: To remove the need for maintainers to remember to check
6+
# back on issues periodically to see if contributors have
7+
# responded.
8+
# **Who does it impact**: Everyone that works on docs or docs-internal.
9+
10+
on:
11+
issue_comment:
12+
types: created
13+
14+
schedule:
15+
# Schedule for five minutes after the hour every hour
16+
- cron: '5 * * * *'
17+
18+
jobs:
19+
noResponse:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb
23+
with:
24+
token: ${{ github.token }}
25+
closeComment: >
26+
This issue has been automatically closed because there has been no response
27+
to our request for more information from the original author. With only the
28+
information that is currently in the issue, we don't have enough information
29+
to take action. Please reach out if you have or find the answers we need so
30+
that we can investigate further. See [this blog post on bug reports and the importance of repro steps](https://www.lee-dohm.com/2015/01/04/writing-good-bug-reports/) for more information about the kind of information that may be helpful.

.github/workflows/send-prs-to-how-how-we-work-boards.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ jobs:
3535
3636
var column_id = 13445681;
3737
try {
38-
github.projects.createCard({
38+
await github.projects.createCard({
3939
column_id: column_id,
4040
content_id: context.payload.pull_request.id,
4141
content_type: "PullRequest"
4242
});
4343
} catch (error) {
44-
console.log(error);
44+
if (error.includes('Project already has the associated issue')) {
45+
return
46+
} else {
47+
console.log(error);
48+
}
4549
}

content/index.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,42 @@ featuredLinks:
1313
- /github/getting-started-with-github/managing-remote-repositories
1414
- /github/working-with-github-pages
1515
versions: '*'
16+
children:
17+
- github
18+
- admin
19+
- discussions
20+
- code-security
21+
- actions
22+
- packages
23+
- developers
24+
- rest
25+
- graphql
26+
- insights
27+
- communities
28+
- pages
29+
- education
30+
- desktop
31+
- early-access
32+
externalProducts:
33+
cli:
34+
id: cli
35+
name: GitHub CLI
36+
href: 'https://cli.github.com/manual'
37+
external: true
38+
atom:
39+
id: atom
40+
name: Atom
41+
href: 'https://atom.io/docs'
42+
external: true
43+
electron:
44+
id: electron
45+
name: Electron
46+
href: 'https://electronjs.org/docs'
47+
external: true
48+
codeql:
49+
id: codeql
50+
name: 'CodeQL'
51+
href: 'https://codeql.github.com/docs'
52+
external: true
1653
---
1754

data/products.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

data/reusables/secret-scanning/partner-secret-list-public-repo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Proctorio | Proctorio Registration Key
5050
Proctorio | Proctorio Secret Key
5151
Pulumi | Pulumi Access Token
5252
PyPI | PyPI API Token
53+
RubyGems | RubyGems API Key
5354
Samsara | Samsara API Token
5455
Samsara | Samsara OAuth Access Token
5556
Shopify | Shopify App Shared Secret

includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h4 class="text-mono f5 text-normal text-gray d-md-none">{% data ui.homepage.exp
2626
<div id="current-product" class="d-flex flex-items-center flex-justify-between" style="padding-top: 2px;">
2727
<!-- Product switcher - GitHub.com, Enterprise Server, etc -->
2828
<!-- 404 and 500 error layouts are not real pages so we need to hardcode the name for those -->
29-
{{ allProducts[currentProduct].name }}
29+
{{ productMap[currentProduct].name }}
3030
<svg class="arrow ml-md-1" width="14px" height="8px" viewBox="0 0 14 8" xml:space="preserve" fill="none" stroke="#1277eb"><path d="M1,1l6.2,6L13,1"></path></svg>
3131
</div>
3232
</summary>

lib/all-products.js

Lines changed: 18 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,28 @@
11
const fs = require('fs')
22
const path = require('path')
3-
const slash = require('slash')
4-
const assert = require('assert')
5-
const { difference } = require('lodash')
6-
const yaml = require('js-yaml')
7-
const contentDir = path.join(process.cwd(), 'content')
83
const frontmatter = require('./read-frontmatter')
94
const getApplicableVersions = require('./get-applicable-versions')
105
const removeFPTFromPath = require('./remove-fpt-from-path')
116

12-
// the product order is determined by data/products.yml
13-
const productsFile = path.join(process.cwd(), 'data/products.yml')
14-
const productsYml = yaml.load(fs.readFileSync(productsFile, 'utf8'))
15-
const sortedProductIds = productsYml.productsInOrder
16-
17-
const contentProductIds = fs.readdirSync(contentDir, { withFileTypes: true })
18-
.map(entry => {
19-
// `fs.readdir` provides file entries based on `fs.lstat`, which doesn't
20-
// resolve symbolic links to their target file/directory. We need to take
21-
// an extra step here to resolve the Early Access symlinked directory.
22-
const { name } = entry
23-
if (entry.isSymbolicLink()) {
24-
entry = fs.statSync(path.join(contentDir, entry.name))
25-
entry.name = name
26-
}
27-
return entry
28-
})
29-
.filter(entry => entry.isDirectory())
30-
.map(entry => entry.name)
31-
32-
// require the content/<subdir> list to match the list in data/products.yml,
33-
// with the exception of content/early-access, which lives in a separate private repo
34-
const publicContentProductIds = contentProductIds.filter(id => id !== 'early-access')
35-
assert(difference(sortedProductIds, publicContentProductIds).length === 0)
36-
assert(difference(publicContentProductIds, sortedProductIds).length === 0)
7+
// Both internal and external products are specified in content/index.md
8+
const homepage = path.posix.join(process.cwd(), 'content/index.md')
9+
const { data } = frontmatter(fs.readFileSync(homepage, 'utf8'))
10+
const productIds = data.children
11+
const externalProducts = data.externalProducts
3712

3813
const internalProducts = {}
3914

40-
// add optional early access content dir to sorted products list if present
41-
const earlyAccessId = contentProductIds.find(id => id === 'early-access')
42-
if (earlyAccessId) sortedProductIds.push(earlyAccessId)
43-
44-
sortedProductIds.forEach(productId => {
15+
productIds.forEach(productId => {
4516
const relPath = productId
46-
const dir = slash(path.join('content', relPath))
47-
const toc = slash(path.join(dir, 'index.md'))
17+
const dir = path.posix.join('content', relPath)
18+
19+
// Early Access may not exist in the current checkout
20+
if (!fs.existsSync(dir)) return
21+
22+
const toc = path.posix.join(dir, 'index.md')
4823
const { data } = frontmatter(fs.readFileSync(toc, 'utf8'))
4924
const applicableVersions = getApplicableVersions(data.versions, toc)
50-
const href = removeFPTFromPath(slash(path.join('/', applicableVersions[0], productId)))
25+
const href = removeFPTFromPath(path.posix.join('/', applicableVersions[0], productId))
5126

5227
internalProducts[productId] = {
5328
id: productId,
@@ -62,33 +37,9 @@ sortedProductIds.forEach(productId => {
6237
internalProducts[productId].versions = applicableVersions
6338
})
6439

65-
const externalProducts = {
66-
cli: {
67-
id: 'cli',
68-
name: 'GitHub CLI',
69-
href: 'https://cli.github.com/manual',
70-
external: true
71-
},
72-
atom: {
73-
id: 'atom',
74-
name: 'Atom',
75-
href: 'https://atom.io/docs',
76-
external: true
77-
},
78-
electron: {
79-
id: 'electron',
80-
name: 'Electron',
81-
href: 'https://electronjs.org/docs',
82-
external: true
83-
},
84-
codeql: {
85-
id: 'codeql',
86-
name: 'CodeQL',
87-
href: 'https://codeql.github.com/docs',
88-
external: true
89-
}
90-
}
40+
const productMap = Object.assign({}, internalProducts, externalProducts)
9141

92-
const allProducts = Object.assign({}, internalProducts, externalProducts)
93-
94-
module.exports = allProducts
42+
module.exports = {
43+
productIds,
44+
productMap
45+
}

lib/frontmatter.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,46 @@ const schema = {
129129
name: { type: 'string' },
130130
URL: { type: 'string' }
131131
}
132+
},
133+
// Child links specified on any TOC page
134+
children: {
135+
type: 'array'
136+
},
137+
// External products specified on the homepage
138+
externalProducts: {
139+
type: 'object',
140+
properties: {
141+
cli: {
142+
type: 'object',
143+
required: true,
144+
properties: {
145+
id: { type: 'string', required: true },
146+
name: { type: 'string', required: true },
147+
href: { type: 'string', format: 'url', required: true },
148+
external: { type: 'boolean', required: true }
149+
}
150+
},
151+
atom: {
152+
type: 'object',
153+
required: true,
154+
properties: {
155+
id: { type: 'string', required: true },
156+
name: { type: 'string', required: true },
157+
href: { type: 'string', format: 'url', required: true },
158+
external: { type: 'boolean', required: true }
159+
}
160+
},
161+
electron: {
162+
type: 'object',
163+
required: true,
164+
properties: {
165+
id: { type: 'string', required: true },
166+
name: { type: 'string', required: true },
167+
href: { type: 'string', format: 'url', required: true },
168+
external: { type: 'boolean', required: true }
169+
}
170+
}
171+
}
132172
}
133173
}
134174
}

lib/get-toc-items.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const productTOCs = Object.values(require('./all-products'))
1+
const { productMap } = require('./all-products')
2+
const productTOCs = Object.values(productMap)
23
.filter(product => !product.external)
34
.map(product => product.toc.replace('content/', ''))
45

0 commit comments

Comments
 (0)