Skip to content

Commit

Permalink
Merge branch 'universe-2022-megabranch' into blackbird-public-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
saritai authored Nov 4, 2022
2 parents 83be843 + 9dac3ea commit 64a2a07
Show file tree
Hide file tree
Showing 1,672 changed files with 79,909 additions and 62,768 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ Poke around several pages, ensure that the stylesheets are working properly, ima

## Step 5: Remove static files for the version

**Note:** We do not remove the old content for GHES release notes. New release notes can be added after we perform a deprecation in some rare cases, and not removing this content makes it easier for us to re-scrape the content to add to Azure Blob Storage.

- [ ] In your `docs-internal` checkout, create a new branch `remove-<version>-static-files` branch: `git checkout -b remove-<version>-static-files` (you can branch off of `main` or from your `deprecate-<version>` branch, up to you).
- [ ] Run `script/enterprise-server-deprecations/remove-static-files.js` and commit results.
- [ ] Re-generate the static files by running `script/rest/update-files.js --decorate-only`.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ jobs:
- uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
- uses: github/codeql-action/init@1ed1437484560351c5be56cf73a48a279d116b78
with:
languages: javascript # comma separated list of values from {go, python, javascript, java, cpp, csharp} (not YET ruby, sorry!)
languages: javascript # comma separated list of values from {go, python, javascript, java, cpp, csharp, ruby}
- uses: github/codeql-action/analyze@1ed1437484560351c5be56cf73a48a279d116b78
continue-on-error: true
14 changes: 14 additions & 0 deletions .github/workflows/sync-search-elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ name: Sync search Elasticsearch

on:
workflow_dispatch:
inputs:
version:
description: "Version to exclusively generate the search index for. E.g. 'dotcom', 'ghes-3.7', 'ghae'"
required: false
default: ''
schedule:
- cron: '23 */4 * * *' # Run every 4 hours at 23 minutes past the hour

Expand Down Expand Up @@ -88,6 +93,10 @@ jobs:
# let's just accept an empty string instead.
THROW_ON_EMPTY: false

# Note that by default, this is '' (empty string) and that means
# the same as not set within the script.
VERSION: ${{ github.event.inputs.version }}

run: |
mkdir /tmp/records
npm run sync-search-indices -- \
Expand All @@ -102,6 +111,11 @@ jobs:
curl --fail --retry-connrefused --retry 5 -I ${{ env.ELASTICSEARCH_URL }}
- name: Index into Elasticsearch
env:
# Must match what we used when scraping (npm run sync-search-indices)
# otherwise the script will seek other versions from disk that might
# not exist.
VERSION: ${{ github.event.inputs.version }}
run: |
./script/search/index-elasticsearch.js \
--language ${{ matrix.language }} -- /tmp/records
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/test-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Translations tests

# **What it does**: Runs our translation tests on cron.
# **Why we have it**: We want to know if translations act up, but they are in separate repositories.
# **Who does it impact**: Docs engineering.

on:
workflow_dispatch:
schedule:
- cron: '35 16 * * *' # Run once per day at 16:35 UTC / 9:35 PST

permissions:
contents: read
pull-requests: read

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
test:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-20.04-xl
timeout-minutes: 60
steps:
- name: Check out repo
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748

- name: Setup node
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048
with:
node-version: '16.17.0'
cache: npm

- name: Install dependencies
run: npm ci

- name: Cache nextjs build
uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

- name: Run build script
run: npm run build

- name: Run tests
run: npm test -- tests/translations

send-slack-notification-on-failure:
needs: [test]
runs-on: ubuntu-20.04-xl
if: ${{ failure() }}
steps:
- name: Send Slack notification if workflow failed
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
if: ${{ failure() }}
with:
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
color: failure
text: Translations test failure. See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
13 changes: 1 addition & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:

permissions:
contents: read
# Needed for the 'trilom/file-changes-action' action
pull-requests: read

# This allows a subsequently queued workflow run to interrupt previous runs
Expand All @@ -37,17 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-group:
[
content,
graphql,
meta,
rendering,
routing,
unit,
linting,
translations,
]
test-group: [content, graphql, meta, rendering, routing, unit, linting]
steps:
- name: Install a local Elasticsearch for testing
# For the sake of saving time, only run this step if the test-group
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.
Binary file modified assets/images/help/classroom/student-codespaces-readme-link.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 modified assets/images/help/classroom/student-launch-new-codespace.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 modified assets/images/help/codespaces/find-codespace-name-github.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.
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.
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.
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.
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.
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 modified assets/images/help/security/advisories-tab.png
Binary file added assets/images/help/security/advisory-list.png
4 changes: 1 addition & 3 deletions components/article/ArticlePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ export const ArticlePage = () => {
</Link>
</div>
)}
{miniTocItems.length > 1 && (
<MiniTocs pageTitle={title} miniTocItems={miniTocItems} />
)}
{miniTocItems.length > 1 && <MiniTocs miniTocItems={miniTocItems} />}
</>
}
>
Expand Down
4 changes: 1 addition & 3 deletions components/article/AutomatedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export const AutomatedPage = ({ children }: Props) => {
</Lead>
)
}
toc={
miniTocItems.length > 1 && <MiniTocs pageTitle={title} miniTocItems={miniTocItems} />
}
toc={miniTocItems.length > 1 && <MiniTocs miniTocItems={miniTocItems} />}
>
<div id="article-contents">
{renderedPage && (
Expand Down
65 changes: 28 additions & 37 deletions components/graphql/Changelog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,42 @@ export function Changelog({ changelogItems }: Props) {
const slug = slugger.slug(heading)

return (
<div className={cx(styles.markdownBody, styles.automatedPages)} key={item.date}>
<div key={item.date}>
<h2 id={slug}>
<LinkIconHeading slug={slug} />
{heading}
</h2>
{item.schemaChanges &&
item.schemaChanges.map((change, index) => (
<React.Fragment key={`${item.date}-schema-changes-${index}`}>
<p>{change.title}</p>
<ul>
{change.changes.map((change) => (
<li key={`${item.date}-${change}`}>
<span dangerouslySetInnerHTML={{ __html: change }} />
</li>
))}
</ul>
</React.Fragment>
))}
{item.previewChanges &&
item.previewChanges.map((change, index) => (
<React.Fragment key={`${item.date}-preview-changes-${index}`}>
<p>{change.title}</p>
<ul>
{change.changes.map((change) => (
<li key={`${item.date}-${change}`}>
<span dangerouslySetInnerHTML={{ __html: change }} />
</li>
))}
</ul>
</React.Fragment>
))}
{item.upcomingChanges &&
item.upcomingChanges.map((change, index) => (
<React.Fragment key={`${item.date}-upcoming-changes-${index}`}>
<p>{change.title}</p>
{(item.schemaChanges || []).map((change, index) => (
<React.Fragment key={index}>
<p>{change.title}</p>
<ul>
{change.changes.map((change) => (
<li key={`${item.date}-${change}`}>
<span dangerouslySetInnerHTML={{ __html: change }} />
</li>
<li key={change} dangerouslySetInnerHTML={{ __html: change }} />
))}
</React.Fragment>
))}
</ul>
</React.Fragment>
))}
{(item.previewChanges || []).map((change, index) => (
<React.Fragment key={index}>
<p>{change.title}</p>
<ul>
{change.changes.map((change) => (
<li key={change} dangerouslySetInnerHTML={{ __html: change }} />
))}
</ul>
</React.Fragment>
))}
{(item.upcomingChanges || []).map((change, index) => (
<React.Fragment key={index}>
<p>{change.title}</p>
{change.changes.map((change) => (
<li key={change} dangerouslySetInnerHTML={{ __html: change }} />
))}
</React.Fragment>
))}
</div>
)
})

return <div>{changes}</div>
return <div className={cx(styles.markdownBody, styles.automatedPages)}>{changes}</div>
}
11 changes: 7 additions & 4 deletions components/guides/LearningTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ActionList } from '@primer/react'
import { useState } from 'react'
import { FeaturedTrack } from 'components/context/ProductGuidesContext'
import { TruncateLines } from 'components/ui/TruncateLines'
import slugger from 'github-slugger'
import { slug } from 'github-slugger'
import styles from './LearningTrack.module.scss'
import { Link } from 'components/Link'

Expand All @@ -17,7 +17,7 @@ const DEFAULT_VISIBLE_GUIDES = 4
export const LearningTrack = ({ track }: Props) => {
const [numVisible, setNumVisible] = useState(DEFAULT_VISIBLE_GUIDES)
const { t } = useTranslation('product_guides')
const slug = track?.title ? slugger.slug(track?.title) : ''
const titleSlug = track?.title ? slug(track?.title) : ''
const showAll = () => {
setNumVisible(track?.guides?.length || 0)
}
Expand All @@ -28,8 +28,11 @@ export const LearningTrack = ({ track }: Props) => {
<div className="Box-header color-bg-subtle p-4 d-flex flex-1 flex-items-start flex-wrap">
<div className="d-flex flex-auto flex-items-start col-7 col-md-7 col-xl-7">
<div className="my-xl-0 mr-xl-3">
<h3 id={slug} className={cx('mb-3 color-text f3 text-semibold', styles.hashAnchor)}>
<a className="color-unset" href={`#${slug}`}>
<h3
id={titleSlug}
className={cx('mb-3 color-text f3 text-semibold', styles.hashAnchor)}
>
<a className="color-unset" href={`#${titleSlug}`}>
{track?.title}
</a>
</h3>
Expand Down
5 changes: 4 additions & 1 deletion components/lib/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type SendEventProps = {
exit_visit_duration?: number
exit_scroll_length?: number
link_url?: string
link_samesite?: boolean
search_query?: string
search_context?: string
search_result_query?: string
Expand Down Expand Up @@ -255,11 +256,13 @@ function initCopyButtonEvent() {
function initLinkEvent() {
document.documentElement.addEventListener('click', (evt) => {
const target = evt.target as HTMLElement
const link = target.closest('a[href^="http"]') as HTMLAnchorElement
const link = target.closest('a[href]') as HTMLAnchorElement
if (!link) return
const sameSite = link.origin === location.origin
sendEvent({
type: EventType.link,
link_url: link.href,
link_samesite: sameSite,
})
})
}
Expand Down
18 changes: 14 additions & 4 deletions components/release-notes/GHESReleaseNotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import { GHESReleaseNotesContextT } from './types'
import { GHESReleaseNotePatch } from './GHESReleaseNotePatch'

import styles from './PatchNotes.module.scss'
import { PlainLink } from './PlainLink'

type Props = {
context: GHESReleaseNotesContextT
}

export function GHESReleaseNotes({ context }: Props) {
const router = useRouter()
const { currentProduct } = useMainContext()
Expand Down Expand Up @@ -59,16 +61,24 @@ export function GHESReleaseNotes({ context }: Props) {
{releases.map((release) => {
const releaseLink = `/${router.locale}/${currentVersion.plan}@${release.version}/${currentProduct?.id}/release-notes`

// Use client-side router link component only if it's a supported release.
// Otherwise, it will trigger a NextJS data XHR fetch for releases
// that are deprecated when in fact you should load it regularly
// so it's read as a proxy from the archive.
const LinkComponent = currentVersion.releases.includes(release.version)
? Link
: PlainLink

if (!release.patches || release.patches.length === 0) {
return (
<li key={release.version} className="border-bottom">
<Link
<LinkComponent
href={releaseLink}
className="Link--primary no-underline px-3 py-4 my-0 d-flex flex-items-center flex-justify-between"
>
{release.version}
<LinkExternalIcon />
</Link>
</LinkComponent>
</li>
)
}
Expand All @@ -86,7 +96,7 @@ export function GHESReleaseNotes({ context }: Props) {

return (
<li key={release.version} className="border-bottom">
<Link
<LinkComponent
className="px-3 py-4 my-0 d-flex flex-items-center flex-justify-between"
href={releaseLink}
>
Expand All @@ -95,7 +105,7 @@ export function GHESReleaseNotes({ context }: Props) {
{release.patches.length}{' '}
{release.patches.length === 1 ? 'release' : 'releases'}
</span>
</Link>
</LinkComponent>
</li>
)
})}
Expand Down
10 changes: 5 additions & 5 deletions components/release-notes/PatchNotes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Fragment } from 'react'
import cx from 'classnames'
import slugger from 'github-slugger'
import { slug } from 'github-slugger'
import { ReleaseNotePatch } from './types'
import { Link } from 'components/Link'

Expand Down Expand Up @@ -41,11 +41,11 @@ export function PatchNotes({ patch, withReleaseNoteLabel }: Props) {
return <li key={item} className="f4" dangerouslySetInnerHTML={{ __html: item }} />
}

const slug = item.heading ? slugger.slug(item.heading) : ''
const headingSlug = item.heading ? slug(item.heading) : ''
return (
<Fragment key={slug}>
<h4 id={slug} className={cx(styles.sectionHeading, 'text-bold f4')}>
<Link href={`#${slug}`}>{item.heading}</Link>
<Fragment key={headingSlug}>
<h4 id={headingSlug} className={cx(styles.sectionHeading, 'text-bold f4')}>
<Link href={`#${headingSlug}`}>{item.heading}</Link>
</h4>
{item.notes.map((note) => {
return (
Expand Down
15 changes: 15 additions & 0 deletions components/release-notes/PlainLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { ReactNode } from 'react'

type PlainLinkProps = {
href: string
children: ReactNode
className?: string
}

export function PlainLink({ href, className, children }: PlainLinkProps) {
return (
<a href={href} className={className}>
{children}
</a>
)
}
Loading

0 comments on commit 64a2a07

Please sign in to comment.