Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
ramyaparimi authored Mar 30, 2022
2 parents 8fb1216 + a53c007 commit 0ecf92f
Show file tree
Hide file tree
Showing 189 changed files with 9,489 additions and 5,510 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},

// Set *default* container specific settings.json values on container create.
"settings": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"cSpell.language": ",en"
},
Expand All @@ -34,8 +34,8 @@
"forwardPorts": [4000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm ci && npm run build",
"postCreateCommand": "git lfs pull && npm ci",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main-preview-docker-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ concurrency:

jobs:
build-and-push-nonprod-cache:
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
runs-on: ubuntu-latest
timeout-minutes: 15
env:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/needs-sme-stale-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Stale check for issues or PRs with "needs SME" label

# **What it does**: Provides stale checks on issues/PRs that need SME(subject matter expert) review on open source docs repo.
# **Why we have it**: In the open repo, we want we want frequent checks on issues/PRs that are waiting on SME review.
# **Who does it impact**: Anyone working in the open repo.

on:
schedule:
- cron: '40 20 * * *' # Run each day at 20:40 UTC / 12:40 PST

permissions:
issues: write
pull-requests: write

jobs:
stale_needs-sme:
if: ${{ github.repository == 'github/docs'' }}
runs-on: ubuntu-latest

steps:
- uses: actions/stale@7fb802b3079a276cf3c7e6ba9aa003c665b3f838
with:
only-labels: needs SME
remove-stale-when-updated: true
days-before-stale: 7 # adds stale label if no activity for 7 days
stale-issue-message: 'This is a gentle bump for the docs team that this issue is waiting for technical review.'
stale-issue-label: SME stale
days-before-issue-close: -1 # never close
stale-pr-message: 'This is a gentle bump for the docs team that this PR is waiting for technical review.'
stale-pr-label: SME stale
days-before-pr-close: -1 # never close
31 changes: 31 additions & 0 deletions .github/workflows/needs-sme-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Comment on adding "needs SME" label

# **What it does**: Comment on issues and pull requests when a "needs SME" label is added. SME = subject matter expert.
# **Why we have it**: We want to manage our queue of issues and pull requests that need sme review.
# **Who does it impact**: Everyone that works on docs or docs-internal.

on:
issues:
types: [labeled]
pull_request_target:
types: [labeled]

permissions:
issues: write
pull-requests: write

jobs:
add-comment:
if: ${{ github.repository == 'github/docs' && (github.event.label.name == 'needs SME' && github.event_name == 'issues' || github.event_name == 'pull_request_target') }}
runs-on: ubuntu-latest
steps:
- uses: peter-evans/create-or-update-comment@a35cf36e5301d70b76f316e867e7788a55a31dae
with:
issue-number: ${{ github.event.issue.number }}
body: |
Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert :eyes:
- uses: peter-evans/create-or-update-comment@a35cf36e5301d70b76f316e867e7788a55a31dae
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert :eyes:
12 changes: 12 additions & 0 deletions .github/workflows/sync-search-indices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ jobs:
env:
VERSION: ${{ github.event.inputs.version }}
LANGUAGE: ${{ github.event.inputs.language }}
# We don't want or need the changelog entries in this context.
# Pages that display the content from these isn't included
# in search index bodies anyway.
CHANGELOG_DISABLED: true
# If a reusable, or anything in the `data/*` directory is deleted
# you might get a
#
# RenderError: Can't find the key 'site.data.reusables...' in the scope
#
# But that'll get fixed in the next translation pipeline. For now,
# let's just accept an empty string instead.
THROW_ON_EMPTY: false
run: npm run sync-search

- name: Update private docs repository search indexes
Expand Down
38 changes: 22 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ jobs:
fail-fast: false
matrix:
# The same array lives in test-windows.yml, so make any updates there too.
test-group: [
test-group:
[
content,
graphql,
meta,
rendering,
routing,
unit,
# linting,
linting,
translations,
]
steps:
Expand All @@ -47,7 +48,10 @@ jobs:
- name: Check out repo
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
lfs: true
# Not all test suites need the LFS files. So instead, we opt to
# NOT clone them initially and instead, include them manually
# only for the test groups that we know need the files.
lfs: ${{ matrix.test-group == 'content' }}
# Enables cloning the Early Access repo later with the relevant PAT
persist-credentials: 'false'

Expand Down Expand Up @@ -98,23 +102,25 @@ jobs:
mv docs-early-access/data data/early-access
rm -r docs-early-access
# This is necessary when LFS files where cloned but does nothing
# if actions/checkout was run with `lfs:false`.
- name: Checkout LFS objects
run: git lfs checkout

# - name: Gather files changed
# uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b
# id: get_diff_files
# with:
# # So that `steps.get_diff_files.outputs.files` becomes
# # a string like `foo.js path/bar.md`
# output: ' '
- name: Gather files changed
uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b
id: get_diff_files
with:
# So that `steps.get_diff_files.outputs.files` becomes
# a string like `foo.js path/bar.md`
output: ' '

# - name: Insight into changed files
# run: |
- name: Insight into changed files
run: |
# # Must to do this because the list of files can be HUGE. Especially
# # in a repo-sync when there are lots of translation files involved.
# echo "${{ steps.get_diff_files.outputs.files }}" > get_diff_files.txt
# Must to do this because the list of files can be HUGE. Especially
# in a repo-sync when there are lots of translation files involved.
echo "${{ steps.get_diff_files.outputs.files }}" > get_diff_files.txt
- name: Setup node
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561
Expand All @@ -136,6 +142,6 @@ jobs:

- name: Run tests
env:
# DIFF_FILE: get_diff_files.txt
DIFF_FILE: get_diff_files.txt
CHANGELOG_CACHE_FILE_PATH: tests/fixtures/changelog-feed.json
run: npm test -- tests/${{ matrix.test-group }}/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed assets/images/github-apps/beta-features-option.png
Binary file not shown.
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 not shown.
Binary file removed assets/images/help/commits/Commit-branch-label.png
Binary file not shown.
Binary file removed assets/images/help/commits/Commit-master-label.png
Binary file not shown.
Binary file not shown.
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 not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed assets/images/help/repository/workflow-sidebar.png
Diff not rendered.
Diff not rendered.
Binary file removed assets/images/settings/developer_settings.png
Diff not rendered.
2 changes: 2 additions & 0 deletions components/context/MainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export type MainContextT = {

status: number
fullUrl: string
isDotComAuthenticated: boolean
}

export const getMainContext = (req: any, res: any): MainContextT => {
Expand Down Expand Up @@ -189,6 +190,7 @@ export const getMainContext = (req: any, res: any): MainContextT => {
nonEnterpriseDefaultVersion: req.context.nonEnterpriseDefaultVersion,
status: res.statusCode,
fullUrl: req.protocol + '://' + req.get('host') + req.originalUrl,
isDotComAuthenticated: Boolean(req.cookies.dotcom_user),
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/page-header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import styles from './Header.module.scss'

export const Header = () => {
const router = useRouter()
const { relativePath, error } = useMainContext()
const { isDotComAuthenticated, relativePath, error } = useMainContext()
const { currentVersion } = useVersion()
const { t } = useTranslation(['header', 'homepage'])
const [isMenuOpen, setIsMenuOpen] = useState(
Expand All @@ -26,7 +26,8 @@ export const Header = () => {
const [scroll, setScroll] = useState(false)

const signupCTAVisible =
currentVersion === 'free-pro-team@latest' || currentVersion === 'enterprise-cloud@latest'
!isDotComAuthenticated &&
(currentVersion === 'free-pro-team@latest' || currentVersion === 'enterprise-cloud@latest')

useEffect(() => {
function onScroll() {
Expand Down
29 changes: 12 additions & 17 deletions components/rest/PreviewsRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { useTranslation } from 'components/hooks/useTranslation'

type Props = {
slug: string
hasRequiredPreviews: boolean
xGitHub: xGitHub
}

export function PreviewsRow({ slug, hasRequiredPreviews, xGitHub }: Props) {
export function PreviewsRow({ slug, xGitHub }: Props) {
const { t } = useTranslation('products')
const hasPreviews = xGitHub.previews && xGitHub.previews.length > 0

Expand All @@ -19,21 +18,17 @@ export function PreviewsRow({ slug, hasRequiredPreviews, xGitHub }: Props) {
<td>string</td>
<td>header</td>
<td>
{hasRequiredPreviews ? (
<p>{t('rest.reference.preview_notice_to_change')}.</p>
) : (
<p className="m-0">
Setting to
<code>application/vnd.github.v3+json</code> is recommended.
{hasPreviews && (
<a href={`#${slug}-preview-notices`} className="d-inline">
{xGitHub.previews.length > 1
? ` ${t('rest.reference.see_preview_notices')}`
: ` ${t('rest.reference.see_preview_notice')}`}
</a>
)}
</p>
)}
<p className="m-0">
Setting to
<code>application/vnd.github.v3+json</code> is recommended.
{hasPreviews && (
<a href={`#${slug}-preview-notices`} className="d-inline">
{xGitHub.previews.length > 1
? ` ${t('rest.reference.see_preview_notices')}`
: ` ${t('rest.reference.see_preview_notice')}`}
</a>
)}
</p>
</td>
</tr>
)
Expand Down
14 changes: 8 additions & 6 deletions components/rest/RestOperation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ import { RestResponse } from './RestResponse'
import { Operation } from './types'
import { RestNotes } from './RestNotes'
import { RestPreviewNotice } from './RestPreviewNotice'
import { useTranslation } from 'components/hooks/useTranslation'
import { RestStatusCodes } from './RestStatusCodes'

type Props = {
operation: Operation
index: number
}

export function RestOperation({ operation }: Props) {
const { t } = useTranslation('products')
const previews = operation['x-github'].previews
const hasRequiredPreviews = previews
? previews.filter((preview) => preview.required).length > 0
: false
const nonErrorResponses = operation.responses.filter(
(response) => parseInt(response.httpStatusCode) < 400
)

return (
<div>
Expand All @@ -29,7 +32,6 @@ export function RestOperation({ operation }: Props) {
{operation.parameters && (
<RestParameterTable
slug={operation.slug}
hasRequiredPreviews={hasRequiredPreviews}
xGitHub={operation['x-github']}
parameters={operation.parameters}
bodyParameters={operation.bodyParameters}
Expand All @@ -38,7 +40,7 @@ export function RestOperation({ operation }: Props) {
{operation['x-codeSamples'] && operation['x-codeSamples'].length > 0 && (
<RestCodeSamples slug={operation.slug} xCodeSamples={operation['x-codeSamples']} />
)}
<RestResponse responses={operation.responses} />
<RestResponse responses={nonErrorResponses} />
{(operation.notes.length > 0 || operation['x-github'].enabledForGitHubApps) && (
<RestNotes
notes={operation.notes}
Expand All @@ -48,7 +50,7 @@ export function RestOperation({ operation }: Props) {
{previews && (
<RestPreviewNotice slug={operation.slug} previews={operation['x-github'].previews} />
)}
<RestResponse responses={operation.responses} variant="error" />
<RestStatusCodes heading={t('rest.reference.status_codes')} responses={operation.responses} />
</div>
)
}
11 changes: 2 additions & 9 deletions components/rest/RestParameterTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@ import { BodyParameterRows } from './BodyParametersRows'

type Props = {
slug: string
hasRequiredPreviews: boolean
xGitHub: xGitHub
parameters: Array<Parameter>
bodyParameters: Array<BodyParameter>
}

export function RestParameterTable({
slug,
hasRequiredPreviews,
xGitHub,
parameters,
bodyParameters,
}: Props) {
export function RestParameterTable({ slug, xGitHub, parameters, bodyParameters }: Props) {
const { t } = useTranslation('products')

return (
Expand All @@ -38,7 +31,7 @@ export function RestParameterTable({
</tr>
</thead>
<tbody>
<PreviewsRow slug={slug} hasRequiredPreviews={hasRequiredPreviews} xGitHub={xGitHub} />
<PreviewsRow slug={slug} xGitHub={xGitHub} />
<ParameterRows parameters={parameters} />
<BodyParameterRows slug={slug} bodyParameters={bodyParameters} />
</tbody>
Expand Down
28 changes: 2 additions & 26 deletions components/rest/RestResponse.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
import { CodeResponse } from './types'
import { CodeBlock } from './CodeBlock'
import { useTranslation } from 'components/hooks/useTranslation'
import { RestResponseTable } from './RestResponseTable'

type Props = {
responses: Array<CodeResponse>
variant?: 'non-error' | 'error'
}

export function RestResponse(props: Props) {
const { responses, variant = 'non-error' } = props
const { t } = useTranslation('products')
const { responses } = props

if (!responses || responses.length === 0) {
return null
}

const filteredResponses = responses.filter((response) => {
const responseCode = parseInt(response.httpStatusCode)

if (variant === 'error') {
return responseCode >= 400
} else {
return responseCode < 400
}
})

if (filteredResponses.length === 0) {
return null
}

if (variant === 'error') {
return (
<RestResponseTable heading={t('rest.reference.error_codes')} responses={filteredResponses} />
)
}

return (
<>
{filteredResponses.map((response, index) => {
{responses.map((response, index) => {
return (
<div key={`${response.httpStatusMessage}-${index}}`}>
<h4 dangerouslySetInnerHTML={{ __html: response.description }} />
Expand Down
Loading

0 comments on commit 0ecf92f

Please sign in to comment.