Skip to content

repo sync #15943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
50c0b2d
Removed duplicate actions reusable folder
sophietheking Feb 25, 2022
c9258a8
Merge branch 'main' into sophie-5758
sophietheking Feb 25, 2022
91f9349
Restoring a deleted organization on GHES (#25663)
lecoursen Feb 28, 2022
4707cd9
Merge branch 'main' into repo-sync
Octomerger Feb 28, 2022
7f898c3
Merge pull request #25709 from github/repo-sync
Octomerger Feb 28, 2022
9c8ab14
Set meta description on homepage (#25546)
rsese Feb 28, 2022
2ade7d8
reactify rest pages (#25005)
rachmari Feb 28, 2022
a297f2c
New translation batch for es (#25712)
docubot Feb 28, 2022
eef7705
throw if no value not found in indented_data_reference (#25711)
peterbe Feb 28, 2022
59388cb
Add About commit branches and tag labels
sophietheking Feb 24, 2022
e91372b
Adding screenshots
sophietheking Feb 24, 2022
9f2dda4
Add screenshot and clarify steps
sophietheking Feb 24, 2022
2707805
Optimize images
invalid-email-address Feb 25, 2022
675092a
Added link to information on tagging
sophietheking Feb 28, 2022
9dc1088
Adding steps to procedural section
sophietheking Feb 28, 2022
547a12c
Added a screenshot and a reusable
sophietheking Feb 28, 2022
409e7f8
Optimize images
invalid-email-address Feb 28, 2022
46a5416
Deleted Commit branch and tag labels page
sophietheking Feb 28, 2022
aa9ee8b
Removed reference to delete page
sophietheking Feb 28, 2022
bb1800a
Update content model to use `people` instead of `customers` (#25714)
ethanpalm Feb 28, 2022
bada144
lower rate limit in production much higher in dev and test (#25688)
peterbe Feb 28, 2022
ec09e7b
New translation batch for pt (#25708)
docubot Feb 28, 2022
dde4ae9
don't bother caching the lib/redirects/.redirects-cache_en_ja.json in…
peterbe Feb 28, 2022
a0844f6
New translation batch for cn (#25713)
docubot Feb 28, 2022
999e95e
New translation batch for ja (#25715)
docubot Feb 28, 2022
eee9933
Replace indented reusables
sophietheking Mar 1, 2022
1c75866
Merge branch 'main' into sophie-5758
sophietheking Mar 1, 2022
ccf02c1
Merge pull request #25657 from github/sophie-5758
sophietheking Mar 1, 2022
3ade48f
Update supported GitHub runners (#24186)
Steve-Glass Mar 1, 2022
6254af4
Merge branch 'main' into repo-sync
Octomerger Mar 1, 2022
80ace67
Merge pull request #25718 from github/repo-sync
Octomerger Mar 1, 2022
d11f852
CodeQL: Update SARIF uploading example (#25702)
RasmusWL Mar 1, 2022
9dff6e5
Update content/pull-requests/committing-changes-to-your-project/creat…
sophietheking Mar 1, 2022
88d5002
Merge branch 'main' into sophie-5306
sophietheking Mar 1, 2022
e81b8b3
Merge pull request #25603 from github/sophie-5306
sophietheking Mar 1, 2022
e69144b
temporarily re-introduct includes/rest_operations_at_current_path.htm…
peterbe Mar 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 0 additions & 6 deletions .github/workflows/browser-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,5 @@ jobs:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

- name: Cache lib/redirects/.redirects-cache_en_ja.json
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: lib/redirects/.redirects-cache_en_ja.json
key: ${{ runner.os }}-redirects-cache-${{ hashFiles('.github/workflows/browser-test.yml') }}

- name: Run browser-test
run: npm run browser-test
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ COPY stylesheets ./stylesheets
COPY pages ./pages
COPY components ./components
COPY lib ./lib

# One part of the build relies on this content file to pull all-products
COPY content/index.md ./content/index.md

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/help/commits/commit-tag-label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/help/commits/commits-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions components/DefaultLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export const DefaultLayout = (props: Props) => {
fullUrl,
status,
} = useMainContext()
const { t } = useTranslation(['errors', 'scroll_button'])
const { t } = useTranslation(['errors', 'meta', 'scroll_button'])
const router = useRouter()
const metaDescription = page.introPlainText ? page.introPlainText : t('default_description')
return (
<div className="d-lg-flex">
<Head>
Expand All @@ -37,7 +38,7 @@ export const DefaultLayout = (props: Props) => {
) : null}

{/* For Google and Bots */}
{page.introPlainText && <meta name="description" content={page.introPlainText} />}
<meta name="description" content={metaDescription} />
{page.hidden && <meta name="robots" content="noindex" />}
{page.languageVariants.map((languageVariant) => {
return (
Expand Down
11 changes: 8 additions & 3 deletions components/article/ArticlePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect } from 'react'
import { useState, useEffect, ReactNode } from 'react'
import { useRouter } from 'next/router'
import dynamic from 'next/dynamic'
import cx from 'classnames'
Expand Down Expand Up @@ -50,7 +50,11 @@ const interactiveAlternatives: Record<string, { href: string }> = {
},
}

export const ArticlePage = () => {
export type StructuredContentT = {
structuredContent?: ReactNode
}

export const ArticlePage = ({ structuredContent }: StructuredContentT) => {
const { asPath } = useRouter()
const {
title,
Expand All @@ -65,6 +69,7 @@ export const ArticlePage = () => {
miniTocItems,
currentLearningTrack,
} = useArticleContext()
const renderedContent = structuredContent || renderedPage
const { t } = useTranslation('pages')
const currentPath = asPath.split('?')[0]

Expand Down Expand Up @@ -236,7 +241,7 @@ export const ArticlePage = () => {
}
>
<div id="article-contents">
<MarkdownContent>{renderedPage}</MarkdownContent>
<MarkdownContent>{renderedContent}</MarkdownContent>
{effectiveDate && (
<div className="mt-4" id="effectiveDate">
Effective as of:{' '}
Expand Down
2 changes: 1 addition & 1 deletion components/context/ArticleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type ArticleContextT = {
title: string
intro: string
effectiveDate: string
renderedPage: string
renderedPage: string | JSX.Element[]
miniTocItems: Array<MiniTocItem>
contributor: { name: string; URL: string } | null
permissions?: string
Expand Down
5 changes: 5 additions & 0 deletions components/context/MainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ export type ProductGroupT = {
}

type VersionItem = {
// free-pro-team@latest, enterprise-cloud@latest, enterprise-server@3.3 ...
version: string
versionTitle: string
currentRelease: string
latestVersion: string
shortName: string
// api.github.com, ghes-3.3, github.ae
openApiVersionName: string
// api.github.com, ghes-, github.ae
openApiBaseName: string
}

export type ProductTreeNode = {
Expand Down
32 changes: 14 additions & 18 deletions components/page-header/RestBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import { useRouter } from 'next/router'
import { Link } from 'components/Link'

const restRepoDisplayPages = [
'/rest/reference/branches',
'/rest/reference/collaborators',
'/rest/reference/commits',
'/rest/reference/deployments',
'/rest/reference/pages',
'/rest/reference/releases',
'/rest/reference/repos',
'/rest/reference/metrics',
'/rest/reference/webhooks',
'branches',
'collaborators',
'commits',
'deployments',
'pages',
'releases',
'repos',
'metrics',
'webhooks',
]
const restEnterpriseDisplayPages = ['/rest/reference/enterprise-admin']
const restEnterpriseDisplayPages = ['enterprise-admin']
const restRepoCategoryExceptionsTitles = {
branches: 'Branches',
collaborators: 'Collaborators',
Expand All @@ -28,18 +28,14 @@ const restRepoCategoryExceptionsTitles = {

export const RestBanner = () => {
const router = useRouter()
const restPage = (router.query.restPage as string[]) || []
const asPathRoot = `/${router.query.productId}/${restPage.join('/')}`
if (
!restRepoDisplayPages.includes(asPathRoot) &&
!restEnterpriseDisplayPages.includes(asPathRoot)
) {
const restPage = router.query.category as string
if (!restRepoDisplayPages.includes(restPage) && !restEnterpriseDisplayPages.includes(restPage)) {
return null
}

let noticeString

if (restRepoDisplayPages.includes(asPathRoot)) {
if (restRepoDisplayPages.includes(restPage)) {
const pages = Object.keys(restRepoCategoryExceptionsTitles) as Array<
keyof typeof restRepoCategoryExceptionsTitles
>
Expand All @@ -58,7 +54,7 @@ export const RestBanner = () => {
pages.
</React.Fragment>
)
} else if (restEnterpriseDisplayPages.includes(asPathRoot)) {
} else if (restEnterpriseDisplayPages.includes(restPage)) {
noticeString = (
<React.Fragment>
If you can't find what you're looking for, you might try the{' '}
Expand Down
8 changes: 8 additions & 0 deletions components/rest/CodeBlock.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.codeBlock {
pre {
margin-bottom: 0;
border: 1px solid var(--color-border-default);
max-height: 32rem;
overflow: auto;
}
}
29 changes: 29 additions & 0 deletions components/rest/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import cx from 'classnames'

import styles from './CodeBlock.module.scss'

type Props = {
verb?: string
codeBlock: string
setHTML?: boolean
}

export function CodeBlock({ verb, codeBlock, setHTML = false }: Props) {
return setHTML ? (
<div
className={cx(styles.codeBlock, 'rounded')}
dangerouslySetInnerHTML={{ __html: codeBlock }}
/>
) : (
<pre className={cx(styles.methodCodeBlock, 'mb-3 rounded-1 border')}>
<code>
{verb && (
<span className="color-bg-accent-emphasis color-fg-on-emphasis rounded-1 px-2 py-1 text-uppercase">
{verb}
</span>
)}{' '}
{codeBlock}
</code>
</pre>
)
}
48 changes: 48 additions & 0 deletions components/rest/RestCodeSamples.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { xCodeSample } from './types'
import { useTranslation } from 'components/hooks/useTranslation'
import { CodeBlock } from './CodeBlock'

type Props = {
slug: string
xCodeSamples: Array<xCodeSample>
}

export function RestCodeSamples({ slug, xCodeSamples }: Props) {
const { t } = useTranslation('products')

return (
<>
<h4 className="pt-3 my-4" id={`${slug}--code-samples`}>
<a href={`#${slug}--code-samples`}>{`${t('rest.reference.code_samples')}`}</a>
</h4>
{xCodeSamples.map((sample: xCodeSample, index: number) => {
const sampleElements: JSX.Element[] = []
if (sample.lang !== 'Ruby') {
sampleElements.push(
sample.lang === 'JavaScript' ? (
<h5 key={`${sample.lang}-${index}`} className="pt-3">
{sample.lang} (
<a className="text-underline" href="https://github.com/octokit/core.js#readme">
@octokit/core.js
</a>
)
</h5>
) : (
<h5 key={`${sample.lang}-${index}`} className="pt-3">
{sample.lang}
</h5>
)
)
sampleElements.push(
<CodeBlock
key={sample.lang + index}
codeBlock={sample.sourceHTML}
setHTML={true}
></CodeBlock>
)
}
return sampleElements
})}
</>
)
}
10 changes: 10 additions & 0 deletions components/rest/RestHTTPMethod.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { CodeBlock } from './CodeBlock'

type Props = {
verb: string
requestPath: string
}

export function RestHTTPMethod({ verb, requestPath }: Props) {
return <CodeBlock verb={verb} codeBlock={requestPath}></CodeBlock>
}
26 changes: 26 additions & 0 deletions components/rest/RestNotes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useTranslation } from 'components/hooks/useTranslation'

type Props = {
notes: Array<string>
enabledForGitHubApps: boolean
}

export function RestNotes({ notes, enabledForGitHubApps }: Props) {
const { t } = useTranslation('products')

return (
<>
<h4 className="pt-4">{t('rest.reference.notes')}</h4>
<ul className="mt-2 pl-3 pb-2">
{enabledForGitHubApps && (
<li>
<a href="/developers/apps">Works with GitHub Apps</a>
</li>
)}
{notes.map((note: string) => {
return <li>{note}</li>
})}
</ul>
</>
)
}
53 changes: 53 additions & 0 deletions components/rest/RestOperation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { RestOperationHeading } from './RestOperationHeading'
import { RestHTTPMethod } from './RestHTTPMethod'
import { RestParameterTable } from './RestParameterTable'
import { RestCodeSamples } from './RestCodeSamples'
import { RestResponse } from './RestResponse'
import { Operation } from './types'
import { RestNotes } from './RestNotes'
import { RestPreviewNotice } from './RestPreviewNotice'

type Props = {
operation: Operation
index: number
}

export function RestOperation({ operation }: Props) {
const previews = operation['x-github'].previews
const hasRequiredPreviews = previews
? previews.filter((preview) => preview.required).length > 0
: false

return (
<div>
<RestOperationHeading
slug={operation.slug}
summary={operation.summary}
descriptionHTML={operation.descriptionHTML}
/>
<RestHTTPMethod verb={operation.verb} requestPath={operation.requestPath} />
{operation.parameters && (
<RestParameterTable
slug={operation.slug}
hasRequiredPreviews={hasRequiredPreviews}
xGitHub={operation['x-github']}
parameters={operation.parameters}
bodyParameters={operation.bodyParameters}
/>
)}
{operation['x-codeSamples'] && operation['x-codeSamples'].length > 0 && (
<RestCodeSamples slug={operation.slug} xCodeSamples={operation['x-codeSamples']} />
)}
<RestResponse responses={operation.responses} />
{(operation.notes.length > 0 || operation['x-github'].enabledForGitHubApps) && (
<RestNotes
notes={operation.notes}
enabledForGitHubApps={operation['x-github'].enabledForGitHubApps}
/>
)}
{previews && (
<RestPreviewNotice slug={operation.slug} previews={operation['x-github'].previews} />
)}
</div>
)
}
21 changes: 21 additions & 0 deletions components/rest/RestOperationHeading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { LinkIcon } from '@primer/octicons-react'

type Props = {
slug: string
summary: string
descriptionHTML: string
}

export function RestOperationHeading({ slug, summary, descriptionHTML }: Props) {
return (
<>
<h3 id={slug}>
<a href={`#${slug}`}>
<LinkIcon size={16} className="m-1" />
</a>
{summary}
</h3>
<div dangerouslySetInnerHTML={{ __html: descriptionHTML }} />
</>
)
}
Loading