Skip to content

Commit

Permalink
Merge pull request #161 from github/main
Browse files Browse the repository at this point in the history
[pull] main from github:main
  • Loading branch information
MarcelRaschke authored Mar 15, 2022
2 parents 1e09e67 + 3290677 commit 635fa8a
Show file tree
Hide file tree
Showing 919 changed files with 7,636 additions and 462,890 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,5 @@ In your `docs-internal` checkout:
- [ ] In `github/github`, edit the release's config file in `app/api/description/config/releases/`, and change `deprecated: false` to `deprecated: true`.
- [ ] Open a new PR, and get the required code owner approvals. A docs-content team member can approve it for the docs team.
- [ ] When the PR is approved, [deploy the `github/github` PR](https://thehub.github.com/engineering/devops/deployment/deploying-dotcom/). If you haven't deployed a `github/github` PR before, work with someone that has -- the process isn't too involved depending on how you deploy, but there are a lot of details that can potentially be confusing as you can see from the documentation.
**Note**: you can do this step independently of the other steps after a GHES version is deprecated since it should no longer get updates in github/github. You should plan to get this PR merged as soon as possible, otherwise if you wait too long our OpenAPI automation may re-add the static files that you removed in step 5.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,3 @@ updates:
schedule:
interval: weekly
day: thursday
ignore:
- dependency-name: '*'
update-types:
['version-update:semver-patch', 'version-update:semver-minor']
8 changes: 8 additions & 0 deletions .github/workflows/azure-preview-env-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ on:
description: 'The commit SHA to build'
type: string
required: true
push:
branches:
- gh-readonly-queue/main/**

permissions:
contents: read
Expand Down Expand Up @@ -162,6 +165,11 @@ jobs:
rsync -rptovR ./user-code/content/./**/*.md ./content
rsync -rptovR ./user-code/assets/./**/*.png ./assets
rsync -rptovR ./user-code/data/./**/*.{yml,md} ./data
rsync -rptovR ./user-code/components/./**/*.{ts,tsx} ./components
rsync -rptovR --ignore-missing-args ./user-code/lib/./**/*.{js,ts} ./lib
rsync -rptovR --ignore-missing-args ./user-code/middleware/./**/*.{js,ts} ./middleware
rsync -rptovR ./user-code/pages/./**/*.tsx ./pages
rsync -rptovR ./user-code/stylesheets/./**/*.scss ./stylesheets
# In addition to making the final image smaller, we also save time by not sending unnecessary files to the docker build context
- name: 'Prune for preview env'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/azure-preview-env-destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
# This will fail if the IMAGE_REPO doesn't exist, but we don't care
- name: 'Untag all docker images for this PR'
run: |
az acr repository delete -n ${{ secrets.NONPROD_REGISTRY_NAME }} --repository ${{ env.IMAGE_REPO }} -y || true
az acr repository delete -n ${{ secrets.NONPROD_REGISTRY_SERVER }} --repository ${{ env.IMAGE_REPO }} -y || true
# Remove all GitHub deployments from this environment and remove the environment
- uses: strumwolf/delete-deployment-environment@45c821e46baa405e25410700fe2e9643929706a0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/link-check-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
push:
branches:
- main
- gh-readonly-queue/main/**
pull_request:

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/move-ready-to-merge-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: move PR
uses: alex-page/github-project-automation-plus@bb266ff4dde9242060e2d5418e120a133586d488
with:
project: Docs team reviews
project: Docs open source board
column: Triage
repo-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/openapi-decorate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
uses: EndBug/add-and-commit@756d9ea820f11931e591eaf57f25e0f5b903d5b2
with:
# The arguments for the `git add` command
add: 'lib/rest/static/decorated'
add: '["lib/rest/static/app", "lib/rest/static/decorated"]'

# The message for the commit
message: 'Add decorated OpenAPI schema files'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/orphaned-assets-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ name: 'Orphaned assets check'

on:
pull_request:
push:
branches:
- gh-readonly-queue/main/**

permissions:
contents: read
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/repo-freeze-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
- unlocked
branches:
- main
push:
branches:
- gh-readonly-queue/main/**

permissions:
contents: none
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ name: Node.js Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- gh-readonly-queue/main/**

permissions:
contents: read
Expand Down Expand Up @@ -132,6 +135,11 @@ jobs:
- name: Run build script
run: npm run build

- name: Warm possible disk caching
env:
NODE_ENV: test
run: ./script/warm-before-tests.mjs

- name: Run tests
env:
DIFF_FILE: get_diff_files.txt
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/triage-unallowed-internal-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- opened
- reopened
- synchronize
push:
branches:
- gh-readonly-queue/main/**

permissions:
# This is needed by dorny/paths-filter
Expand Down
2 changes: 1 addition & 1 deletion .pa11yci
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"http://localhost:4001/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account",
"http://localhost:4001/en/github/authenticating-to-github/creating-a-strong-password",
"http://localhost:4001/en/github",
"http://localhost:4001/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line",
"http://localhost:4001/en/github/importing-your-projects-to-github/adding-locally-hosted-code-to-github",
"http://localhost:4001/en/actions",
"http://localhost:4001/en/github/authenticating-to-github/creating-a-personal-access-token",
"http://localhost:4001/en/github/authenticating-to-github/checking-for-existing-ssh-keys",
Expand Down
Binary file added assets/images/help/issues/burnup-example.png
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/issues/iterations-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion components/DefaultLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const DefaultLayout = (props: Props) => {
style={{ height: '100vh' }}
>
<Header />
<main id="main-content">
<main id="main-content" style={{ scrollMarginTop: '5rem' }}>
<DeprecationBanner />
<RestBanner />

Expand Down
9 changes: 1 addition & 8 deletions components/GenericError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import Link from 'next/link'
import { useRouter } from 'next/router'

import { MarkGithubIcon, CommentDiscussionIcon } from '@primer/octicons-react'
import { useVersion } from 'components/hooks/useVersion'
import { Lead } from 'components/ui/Lead'

export function GenericError() {
const { isEnterprise } = useVersion()

return (
<div className="min-h-screen d-flex flex-column">
<Head>
Expand All @@ -28,11 +25,7 @@ export function GenericError() {
</p>
<a
id="contact-us"
href={
isEnterprise
? 'https://enterprise.github.com/support'
: 'https://support.github.com/contact'
}
href="https://support.github.com/contact"
className="btn btn-outline mt-2"
>
<CommentDiscussionIcon size="small" className="octicon mr-1" />
Expand Down
106 changes: 8 additions & 98 deletions components/article/ArticlePage.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
import { useState, useEffect, ReactNode } from 'react'
import { useState, useEffect } from 'react'
import { useRouter } from 'next/router'
import dynamic from 'next/dynamic'
import cx from 'classnames'
import { ActionList, Heading } from '@primer/react'

import { ZapIcon, InfoIcon, ShieldLockIcon } from '@primer/octicons-react'
import { Callout } from 'components/ui/Callout'

import { Link } from 'components/Link'
import { DefaultLayout } from 'components/DefaultLayout'
import { ArticleTitle } from 'components/article/ArticleTitle'
import { MiniTocItem, useArticleContext } from 'components/context/ArticleContext'
import { useArticleContext } from 'components/context/ArticleContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { LearningTrackNav } from './LearningTrackNav'
import { MarkdownContent } from 'components/ui/MarkdownContent'
import { Lead } from 'components/ui/Lead'
import { ArticleGridLayout } from './ArticleGridLayout'
import { PlatformPicker } from 'components/article/PlatformPicker'
import { ToolPicker } from 'components/article/ToolPicker'
import { MiniTocs } from 'components/ui/MiniTocs'

const ClientSideRedirectExceptions = dynamic(() => import('./ClientsideRedirectExceptions'), {
ssr: false,
})
const ClientSideHighlightJS = dynamic(() => import('./ClientSideHighlightJS'), { ssr: false })

// Mapping of a "normal" article to it's interactive counterpart
Expand Down Expand Up @@ -49,12 +45,11 @@ const interactiveAlternatives: Record<string, { href: string }> = {
href: '/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces?langId=py',
},
}

export type StructuredContentT = {
structuredContent?: ReactNode
type Props = {
children?: React.ReactNode
}

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

const renderTocItem = (item: MiniTocItem) => {
return (
<ActionList.Item
as="li"
key={item.contents}
className={item.platform}
sx={{ listStyle: 'none', padding: '2px' }}
>
<div className={cx('lh-condensed d-block width-full')}>
<div dangerouslySetInnerHTML={{ __html: item.contents }} />
{item.items && item.items.length > 0 ? (
<ul className="ml-3">{item.items.map(renderTocItem)}</ul>
) : null}
</div>
</ActionList.Item>
)
}

// We have some one-off redirects for rest api docs
// currently those are limited to the repos page, but
// that will grow soon as we restructure the rest api docs.
// This is a workaround to updating the hardcoded links
// directly in the REST API code in a separate repo, which
// requires many file changes and teams to sign off.
// While the organization is turbulent, we can do this.
// Once it's more settled, we can refactor the rest api code
// to leverage the OpenAPI urls rather than hardcoded urls.
// The code below determines if we should bother loading this redirecting
// component at all.
// The reason this isn't done at the server-level is because there you
// can't possibly access the URL hash. That's only known in client-side
// code.
const [loadClientsideRedirectExceptions, setLoadClientsideRedirectExceptions] = useState(false)
useEffect(() => {
const { hash, pathname } = window.location
// Today, Jan 2022, it's known explicitly what the pathname.
// In the future there might be more.
// Hopefully, we can some day delete all of this and no longer
// be dependent on the URL hash to do the redirect.
if (
hash &&
(pathname.endsWith('/rest/reference/repos') ||
pathname.endsWith('/rest/reference/enterprise-admin'))
) {
setLoadClientsideRedirectExceptions(true)
}
}, [])

// If the page contains `[data-highlight]` blocks, these pages need
// syntax highlighting. But not every page needs it, so it's conditionally
// lazy-loaded on the client.
Expand All @@ -139,29 +85,8 @@ export const ArticlePage = ({ structuredContent }: StructuredContentT) => {
// consecutive one does.
}, [asPath])

// Scrollable code blocks in our REST API docs and elsewhere aren't accessible
// via keyboard navigation without setting tabindex="0". But we don't want to set
// this attribute on every `<pre>` code block, only the ones where there are scroll
// bars because the content isn't all visible.
useEffect(() => {
const codeBlocks = document.querySelectorAll<HTMLPreElement>('pre')

codeBlocks.forEach((codeBlock) => {
if (
codeBlock.scrollWidth > codeBlock.clientWidth ||
codeBlock.scrollHeight > codeBlock.clientHeight
) {
codeBlock.setAttribute('tabindex', '0')
}
})
}, [])

return (
<DefaultLayout>
{/* Doesn't matter *where* this is included because it will
never render anything. It always just return null. */}
{loadClientsideRedirectExceptions && <ClientSideRedirectExceptions />}

{/* Doesn't matter *where* this is included because it will
never render anything. It always just return null. */}
{lazyLoadHighlightJS && <ClientSideHighlightJS />}
Expand Down Expand Up @@ -220,28 +145,13 @@ export const ArticlePage = ({ structuredContent }: StructuredContentT) => {
</div>
)}
{miniTocItems.length > 1 && (
<>
<Heading as="h2" id="in-this-article" className="mb-1" sx={{ fontSize: 1 }}>
<Link href="#in-this-article">{t('miniToc')}</Link>
</Heading>

<ActionList
key={title}
items={miniTocItems.map((items, i) => {
return {
key: title + i,
text: title,
renderItem: () => <ul>{renderTocItem(items)}</ul>,
}
})}
/>
</>
<MiniTocs pageTitle={title} miniTocItems={miniTocItems} />
)}
</>
}
>
<div id="article-contents">
<MarkdownContent>{renderedContent}</MarkdownContent>
<MarkdownContent>{children || renderedPage}</MarkdownContent>
{effectiveDate && (
<div className="mt-4" id="effectiveDate">
Effective as of:{' '}
Expand Down
10 changes: 10 additions & 0 deletions components/lib/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ function initClipboardEvent() {
})
}

function initCopyButtonEvent() {
document.documentElement.addEventListener('click', (evt) => {
const target = evt.target as HTMLElement
const button = target.closest('.js-btn-copy') as HTMLButtonElement
if (!button) return
sendEvent({ type: EventType.navigate, navigate_label: 'copy icon button' })
})
}

function initLinkEvent() {
document.documentElement.addEventListener('click', (evt) => {
const target = evt.target as HTMLElement
Expand All @@ -267,6 +276,7 @@ export default function initializeEvents() {
initPageAndExitEvent() // must come first
initLinkEvent()
initClipboardEvent()
initCopyButtonEvent()
initPrintEvent()
// survey event in ./survey.js
// experiment event in ./experiment.js
Expand Down
8 changes: 1 addition & 7 deletions components/page-footer/Support.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { PeopleIcon, CommentDiscussionIcon } from '@primer/octicons-react'

import { useTranslation } from 'components/hooks/useTranslation'
import { useVersion } from 'components/hooks/useVersion'
import { useMainContext } from 'components/context/MainContext'

export const Support = () => {
const { isEnterprise } = useVersion()
const { t } = useTranslation('support')
const { communityRedirect } = useMainContext()

Expand All @@ -25,11 +23,7 @@ export const Support = () => {
<div>
<a
id="contact-us"
href={
isEnterprise
? 'https://enterprise.github.com/support'
: 'https://support.github.com/contact'
}
href="https://support.github.com/contact"
className="Link—secondary text-bold"
>
<CommentDiscussionIcon size="small" className="octicon mr-1" />
Expand Down
1 change: 0 additions & 1 deletion components/page-header/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import styles from './Breadcrumbs.module.scss'

export type BreadcrumbT = {
title: string
documentType?: string
href?: string
}

Expand Down
Loading

0 comments on commit 635fa8a

Please sign in to comment.