Skip to content

Commit 1cf7b6d

Browse files
authored
Merge branch 'main' into graphql-schema-update
2 parents 095064f + b3b86c2 commit 1cf7b6d

File tree

131 files changed

+442
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+442
-309
lines changed

content/actions/deployment/security-hardening-your-deployments/using-openid-connect-with-reusable-workflows.md

Lines changed: 1 addition & 1 deletion

content/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections.md

Lines changed: 2 additions & 2 deletions

content/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests.md

Lines changed: 2 additions & 2 deletions

data/features/README.md

Lines changed: 1 addition & 1 deletion

lib/all-versions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const plans = [
1616
releases: [latestNonNumberedRelease],
1717
latestRelease: latestNonNumberedRelease,
1818
nonEnterpriseDefault: true, // permanent way to refer to this plan if the name changes
19+
hasNumberedReleases: false,
1920
openApiBaseName: 'api.github.com', // used for REST
2021
miscBaseName: 'dotcom', // used for GraphQL and webhooks
2122
},
@@ -25,6 +26,7 @@ const plans = [
2526
shortName: 'ghec',
2627
releases: [latestNonNumberedRelease],
2728
latestRelease: latestNonNumberedRelease,
29+
hasNumberedReleases: false,
2830
openApiBaseName: 'api.github.com',
2931
miscBaseName: 'ghec',
3032
},
@@ -44,8 +46,11 @@ const plans = [
4446
shortName: 'ghae',
4547
releases: [latestNonNumberedRelease],
4648
latestRelease: latestNonNumberedRelease,
49+
hasNumberedReleases: false,
4750
openApiBaseName: 'github.ae',
4851
miscBaseName: 'ghae',
52+
allowedFrontmatterPattern: '^issue-\\d+?$',
53+
allowedInlinePattern: '^ghae-issue-\\d+?$',
4954
},
5055
]
5156

lib/frontmatter.js

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ const layoutNames = [
1414
'release-notes',
1515
false,
1616
]
17-
const semverValidRange = semver.validRange
18-
const semverRange = {
19-
type: 'string',
20-
conform: semverValidRange,
21-
message: 'Must be a valid SemVer range',
22-
}
23-
const versionObjs = Object.values(allVersions)
2417

2518
const guideTypes = ['overview', 'quick_start', 'tutorial', 'how_to', 'reference']
2619
const featureVersions = fs
@@ -246,19 +239,44 @@ const featureVersionsProp = {
246239
},
247240
}
248241

242+
const asteriskPattern = /^\*$/
243+
249244
schema.properties.versions = {
250245
type: ['object', 'string'], // allow a '*' string to indicate all versions
251246
required: true,
252-
properties: versionObjs.reduce((acc, versionObj) => {
253-
acc[versionObj.plan] = semverRange
254-
acc[versionObj.shortName] = semverRange
247+
additionalProperties: false, // don't allow any versions in FM that aren't defined in lib/all-versions
248+
properties: Object.values(allVersions).reduce((acc, versionObj) => {
249+
acc[versionObj.plan] = getValidProps(versionObj)
250+
acc[versionObj.shortName] = getValidProps(versionObj)
255251
return acc
256252
}, featureVersionsProp),
257253
}
258254

259-
// Support 'github-ae': next
260-
schema.properties.versions.properties['github-ae'] = 'next'
261-
schema.properties.versions.properties.ghae = 'next'
255+
function getValidProps(versionObj) {
256+
const valid = { type: 'string' }
257+
258+
// The properties attached to versionObj are defined in lib/all-versions.js.
259+
260+
// If a version has no numbered releases or exception pattern, the only valid value is '*'.
261+
if (!(versionObj.hasNumberedReleases || versionObj.allowedFrontmatterPattern)) {
262+
valid.pattern = asteriskPattern
263+
valid.message = `Must have a value of '*'`
264+
}
265+
266+
// If a version has an exception pattern, both '*' and the exception pattern are valid.
267+
if (versionObj.allowedFrontmatterPattern) {
268+
valid.pattern = new RegExp(`${asteriskPattern.source}|${versionObj.allowedFrontmatterPattern}`)
269+
valid.message = `Must have a value of '*' or 'issue-###', where ### is an integer`
270+
}
271+
272+
// If a version has numbered releases, any semver range is valid. Note '*' is a valid semver range.
273+
if (versionObj.hasNumberedReleases) {
274+
valid.conform = semver.validRange
275+
valid.message = 'Must be a valid SemVer range'
276+
}
277+
278+
return valid
279+
}
262280

263281
function frontmatter(markdown, opts = {}) {
264282
const defaults = {

lib/render-content/plugins/use-english-headings.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ export default function useEnglishHeadings({ englishHeadings }) {
1919
// get English slug
2020
const englishSlug = slugger.slug(englishHeading)
2121
// use English slug for heading ID and link
22-
node.properties.id = englishSlug
22+
if (englishSlug) {
23+
// only use English slug if there is one, otherwise we'll end up with
24+
// empty IDs
25+
node.properties.id = englishSlug
26+
}
2327
})
2428
}
2529
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:a54b3c6a9d1abdfe9b5cd0464117d26b6ddc99809a843c7c89e5fd9ecd199921
3-
size 741463
2+
oid sha256:ed16c36428997cd7d3705f1edf1dc967122e8f8a73e7f67538ada3e092230c95
3+
size 741390
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:63ec856eed5675e38b969738a6f2cb2443461f5a389562aa8f6aac4a73ce8e35
3-
size 1564192
2+
oid sha256:05687c572244244f212bab3c96d7bd34384231189cce239da4a27af099f10c7f
3+
size 1564131
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:8b965d9439d85120507e7dacc985e1c4fab7c272d8bba61fd78dcc4780c4b0fa
3-
size 998450
2+
oid sha256:a74e09658956a04ed2b1ef295901d568c1b0d6f325563b03d796c1acaf0b75ca
3+
size 997473

0 commit comments

Comments
 (0)