Skip to content

Commit

Permalink
Merge pull request github#28614 from github/repo-sync
Browse files Browse the repository at this point in the history
Repo sync
  • Loading branch information
docs-bot authored Sep 29, 2023
2 parents 7909c76 + 6c1ec80 commit 2f941bf
Show file tree
Hide file tree
Showing 21 changed files with 2,149 additions and 115 deletions.
1 change: 1 addition & 0 deletions content/rest/orgs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ children:
- /outside-collaborators
- /personal-access-tokens
- /rules
- /rule-suites
- /security-managers
- /webhooks
autogenerated: rest
Expand Down
14 changes: 14 additions & 0 deletions content/rest/orgs/rule-suites.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Rule Suites
shortTitle: Rule Suites
intro: 'Use the REST API to manage rule suites for organizations.'
versions: # DO NOT MANUALLY EDIT. CHANGES WILL BE OVERWRITTEN BY A 🤖
fpt: '*'
ghec: '*'
topics:
- API
autogenerated: rest
allowTitleToDifferFromFilename: true
---

<!-- Content after this section is automatically generated -->
2 changes: 1 addition & 1 deletion content/rest/orgs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Rules
shortTitle: Rules
intro: >-
Use the rulesets API to manage rulesets for repositories. Organization
Use the REST API to manage rulesets for organizations. Organization
rulesets control how people can interact with selected branches and tags in
repositories in an organization.
versions: # DO NOT MANUALLY EDIT. CHANGES WILL BE OVERWRITTEN BY A 🤖
Expand Down
1 change: 1 addition & 0 deletions content/rest/repos/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ children:
- /lfs
- /repos
- /rules
- /rule-suites
- /tags
autogenerated: rest
---
Expand Down
14 changes: 14 additions & 0 deletions content/rest/repos/rule-suites.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Rule Suites
shortTitle: Rule Suites
intro: 'Use the REST API to manage rule suites for repositories.'
versions: # DO NOT MANUALLY EDIT. CHANGES WILL BE OVERWRITTEN BY A 🤖
fpt: '*'
ghec: '*'
topics:
- API
autogenerated: rest
allowTitleToDifferFromFilename: true
---

<!-- Content after this section is automatically generated -->
112 changes: 1 addition & 111 deletions src/content-linter/tests/lint-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ const oldVariableRegex = /{{\s*?site\.data\..*?}}/g
// - {{ octicon-plus An example label }}
//
const oldOcticonRegex = /{{\s*?octicon-([a-z-]+)(\s[\w\s\d-]+)?\s*?}}/g

const relativeArticleLinkErrorText = 'Found unexpected relative article links:'
const languageLinkErrorText = 'Found article links with hard-coded language codes:'
const versionLinkErrorText = 'Found article links with hard-coded version numbers:'
Expand Down Expand Up @@ -328,15 +327,13 @@ describe('lint markdown content', () => {
isTranscript,
isTranscriptLanding,
hasExperimentalAlternative,
frontmatterData,
rawContent
frontmatterData

beforeAll(async () => {
const fileContents = await fs.readFile(markdownAbsPath, 'utf8')
const { data, content: bodyContent } = frontmatter(fileContents)

content = bodyContent
rawContent = fileContents
frontmatterData = data
ast = fromMarkdown(content)
isHidden = data.hidden === true
Expand All @@ -354,25 +351,6 @@ describe('lint markdown content', () => {
})
})

test('placeholder string is not present in any markdown files', async () => {
// this article explains how to use todocs placeholder text so shouldn't fail this test
if (
markdownRelPath ===
'content/contributing/collaborating-on-github-docs/using-the-todocs-placeholder-to-leave-notes.md' ||
markdownRelPath === 'content/contributing/collaborating-on-github-docs/index.md'
) {
return
}
const matches = rawContent.match(placeholderRegex) || []
const placeholderStr = matches.length === 1 ? 'placeholder' : 'placeholders'
const errorMessage = `
Found ${matches.length} ${placeholderStr} '${matches.join(
', ',
)}' in this file! Please update all placeholders.
`
expect(matches.length, errorMessage).toBe(0)
})

test('hidden docs must be Early Access, Site Policy, Search, Experimental, or Transcript', async () => {
// We need to support some non-Early Access hidden docs in Site Policy
if (isHidden) {
Expand Down Expand Up @@ -403,94 +381,6 @@ describe('lint markdown content', () => {
}
})

test('relative URLs must start with "/"', async () => {
const matches = links.filter((link) => {
if (
link.startsWith('http://') ||
link.startsWith('https://') ||
link.startsWith('tel:') ||
link.startsWith('mailto:') ||
link.startsWith('#') ||
link.startsWith('/')
)
return false

return true
})

const errorMessage = formatLinkError(relativeArticleLinkErrorText, matches)
expect(matches.length, errorMessage).toBe(0)
})

test('must not leak Early Access doc URLs', async () => {
// Only execute for docs that are NOT Early Access
if (!isEarlyAccess) {
const matches = content.match(earlyAccessLinkRegex) || []
const errorMessage = formatLinkError(earlyAccessLinkErrorText, matches)
expect(matches.length, errorMessage).toBe(0)
}
})

test('must not leak Early Access image URLs', async () => {
// Only execute for docs that are NOT Early Access
if (!isEarlyAccess) {
const matches = content.match(earlyAccessImageRegex) || []
const errorMessage = formatLinkError(earlyAccessImageErrorText, matches)
expect(matches.length, errorMessage).toBe(0)
}
})

test('must have correctly formatted Early Access image URLs', async () => {
// Execute for ALL docs (not just Early Access) to ensure non-EA docs
// are not leaking incorrectly formatted EA image URLs
const matches = content.match(badEarlyAccessImageRegex) || []
const errorMessage = formatLinkError(badEarlyAccessImageErrorText, matches)
expect(matches.length, errorMessage).toBe(0)
})

test('does not use old site.data variable syntax', async () => {
const matches = content.match(oldVariableRegex) || []
const matchesWithExample = matches.map((match) => {
const example = match.replace(
/{{\s*?site\.data\.([a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]+)+)\s*?}}/g,
'{% data $1 %}',
)
return `${match} => ${example}`
})
const errorMessage = formatLinkError(oldVariableErrorText, matchesWithExample)
expect(matches.length, errorMessage).toBe(0)
})

test('does not use old octicon variable syntax', async () => {
const matches = content.match(oldOcticonRegex) || []
const errorMessage = formatLinkError(oldOcticonErrorText, matches)
expect(matches.length, errorMessage).toBe(0)
})

test('URLs must not contain a hard-coded language code', async () => {
const matches = links.filter((link) => {
return /\/(?:${languageCodes.join('|')})\//.test(link)
})

const errorMessage = formatLinkError(languageLinkErrorText, matches)
expect(matches.length, errorMessage).toBe(0)
})

test('URLs must not contain a hard-coded domain name', async () => {
const initialMatches = content.match(domainLinkRegex) || []

// Filter out some very specific false positive matches
const matches = initialMatches.filter(() => {
if (markdownRelPath === 'content/admin/all-releases.md') {
return false
}
return true
})

const errorMessage = formatLinkError(domainLinkErrorText, matches)
expect(matches.length, errorMessage).toBe(0)
})

test('contains no deprecated frontmatter properties', async () => {
if (!isEarlyAccess) {
const usedDeprecateProps = deprecatedProperties.filter((prop) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,24 @@
"additional-permissions": [],
"access": "write"
},
{
"category": "orgs",
"slug": "list-organization-rule-suites",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/orgs/{org}/rulesets/rule-suites",
"additional-permissions": [],
"access": "write"
},
{
"category": "orgs",
"slug": "get-an-organization-rule-suite",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/orgs/{org}/rulesets/rule-suites/{rule_suite_id}",
"additional-permissions": [],
"access": "write"
},
{
"category": "orgs",
"slug": "get-an-organization-repository-ruleset",
Expand Down Expand Up @@ -2799,6 +2817,24 @@
"additional-permissions": [],
"access": "write"
},
{
"category": "repos",
"slug": "list-repository-rule-suites",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/repos/{owner}/{repo}/rulesets/rule-suites",
"additional-permissions": [],
"access": "write"
},
{
"category": "repos",
"slug": "get-a-repository-rule-suite",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id}",
"additional-permissions": [],
"access": "write"
},
{
"category": "repos",
"slug": "update-a-repository-ruleset",
Expand Down
24 changes: 24 additions & 0 deletions src/github-apps/data/fpt-2022-11-28/fine-grained-pat.json
Original file line number Diff line number Diff line change
Expand Up @@ -3002,6 +3002,18 @@
"verb": "post",
"requestPath": "/orgs/{org}/rulesets"
},
{
"slug": "list-organization-rule-suites",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/orgs/{org}/rulesets/rule-suites"
},
{
"slug": "get-an-organization-rule-suite",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/orgs/{org}/rulesets/rule-suites/{rule_suite_id}"
},
{
"slug": "get-an-organization-repository-ruleset",
"subcategory": "rules",
Expand Down Expand Up @@ -3892,6 +3904,18 @@
"verb": "post",
"requestPath": "/repos/{owner}/{repo}/rulesets"
},
{
"slug": "list-repository-rule-suites",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/repos/{owner}/{repo}/rulesets/rule-suites"
},
{
"slug": "get-a-repository-rule-suite",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id}"
},
{
"slug": "get-a-repository-ruleset",
"subcategory": "rules",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,28 @@
"server-to-server": true,
"additional-permissions": []
},
{
"category": "orgs",
"slug": "list-organization-rule-suites",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/orgs/{org}/rulesets/rule-suites",
"access": "write",
"user-to-server": true,
"server-to-server": true,
"additional-permissions": []
},
{
"category": "orgs",
"slug": "get-an-organization-rule-suite",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/orgs/{org}/rulesets/rule-suites/{rule_suite_id}",
"access": "write",
"user-to-server": true,
"server-to-server": true,
"additional-permissions": []
},
{
"category": "orgs",
"slug": "get-an-organization-repository-ruleset",
Expand Down Expand Up @@ -3481,6 +3503,28 @@
"server-to-server": true,
"additional-permissions": []
},
{
"category": "repos",
"slug": "list-repository-rule-suites",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/repos/{owner}/{repo}/rulesets/rule-suites",
"access": "write",
"user-to-server": true,
"server-to-server": true,
"additional-permissions": []
},
{
"category": "repos",
"slug": "get-a-repository-rule-suite",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id}",
"access": "write",
"user-to-server": true,
"server-to-server": true,
"additional-permissions": []
},
{
"category": "repos",
"slug": "update-a-repository-ruleset",
Expand Down
24 changes: 24 additions & 0 deletions src/github-apps/data/fpt-2022-11-28/server-to-server-rest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,18 @@
"verb": "post",
"requestPath": "/orgs/{org}/rulesets"
},
{
"slug": "list-organization-rule-suites",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/orgs/{org}/rulesets/rule-suites"
},
{
"slug": "get-an-organization-rule-suite",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/orgs/{org}/rulesets/rule-suites/{rule_suite_id}"
},
{
"slug": "get-an-organization-repository-ruleset",
"subcategory": "rules",
Expand Down Expand Up @@ -3520,6 +3532,18 @@
"verb": "post",
"requestPath": "/repos/{owner}/{repo}/rulesets"
},
{
"slug": "list-repository-rule-suites",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/repos/{owner}/{repo}/rulesets/rule-suites"
},
{
"slug": "get-a-repository-rule-suite",
"subcategory": "rule-suites",
"verb": "get",
"requestPath": "/repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id}"
},
{
"slug": "get-a-repository-ruleset",
"subcategory": "rules",
Expand Down
Loading

0 comments on commit 2f941bf

Please sign in to comment.