Skip to content

Update projects-filters.md #1

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

Open
wants to merge 136 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
622a489
service containers should not be used in composite actions
nikola-jokic Feb 1, 2022
73b378b
Merge branch 'github:main' into patch-3
nikola-jokic Feb 1, 2022
33466d5
Merge branch 'github:main' into patch-3
nikola-jokic Feb 2, 2022
8c74e27
Added explanation that everything passed through args will be passed …
nikola-jokic Feb 23, 2022
84f5fe1
Add details about required scopes for Self-Hosted Runner
martindevnow Mar 2, 2022
40a7ad7
Added explanation about masking outputs
nikola-jokic Mar 15, 2022
49243a3
Fixes output of wrong input variable in reusable
SpraxDev Mar 15, 2022
6ac18cb
Remove duplicated lines on self-hosted-runners
uny Mar 22, 2022
5ed48e4
Add mention of `noreply` email addresses to warning
yamiacat Mar 24, 2022
f5d0582
Update content/account-and-profile/setting-up-and-managing-your-githu…
yamiacat Mar 24, 2022
78b31cf
Fix broken link
sophietheking Mar 24, 2022
6947c09
Add `-I` parameter to curl command
gijswijs Mar 25, 2022
8fd2f2f
Clarify a meaning of entitlements
catto Mar 25, 2022
3d44399
Fixed versioning
sophietheking Mar 25, 2022
b357d46
Add :nail_care:
lecoursen Mar 25, 2022
8a7c32d
Merge pull request #26480 from github/repo-sync
Octomerger Mar 25, 2022
682aab8
Fix reference to where data comes from on pulls.md
mathias Mar 25, 2022
c754ae6
Merge branch 'main' into patch-3
lucascosti Mar 28, 2022
3c28299
Update content/actions/using-containerized-services/about-service-con…
lucascosti Mar 28, 2022
27e75c1
Merge branch 'main' into patch-2
lucascosti Mar 28, 2022
8fb1216
Update content/actions/hosting-your-own-runners/autoscaling-with-self…
lucascosti Mar 28, 2022
9063d21
Merge branch 'main' into patch-4
lucascosti Mar 28, 2022
98b52f2
Update content/actions/creating-actions/creating-a-docker-container-a…
nikola-jokic Mar 28, 2022
39d746c
Update content/actions/using-workflows/workflow-commands-for-github-a…
nikola-jokic Mar 28, 2022
6c73c5d
Merge branch 'main' into patch-5
lucascosti Mar 28, 2022
de0c1cb
upgrade react syntax highlighter and prism
gracepark Mar 28, 2022
c4a1cd0
Update projects-filters.md
lorensr Mar 28, 2022
3cc9a09
Merge branch 'main' into patch-2
Mar 28, 2022
5ea5d23
Merge pull request #16444 from uny/patch-2
Mar 29, 2022
6a19904
Merge branch 'main' into repo-sync
Octomerger Mar 29, 2022
38680e1
Merge pull request #26519 from github/repo-sync
Octomerger Mar 29, 2022
5ba6ce3
Merge branch 'main' into upgrade-react-syntax-highlighter
heiskr Mar 29, 2022
0a90686
Update billing csv docs (#26262)
winnie Mar 29, 2022
28792d7
Merge branch 'main' into upgrade-react-syntax-highlighter
heiskr Mar 29, 2022
972cee3
Merge pull request #26515 from github/upgrade-react-syntax-highlighter
heiskr Mar 29, 2022
030c7ee
Merge branch 'main' into catto-patch-1
gracepark Mar 29, 2022
e784ceb
Bump minimist from 1.2.5 to 1.2.6
dependabot[bot] Mar 29, 2022
64c5f98
Merge pull request #26492 from github/catto-patch-1
heiskr Mar 29, 2022
a050ee5
Merge branch 'main' into yamiacat-merge-accounts-patch
heiskr Mar 29, 2022
8d3c668
Merge pull request #26476 from github/yamiacat-merge-accounts-patch
heiskr Mar 29, 2022
d85156e
update link (#26470)
skedwards88 Mar 29, 2022
57cc217
Adds note about GitHub apps (#26320)
emmaviolet Mar 29, 2022
56f2eb1
Update partner-secret-list-public-repo.md (#26507)
Mar 29, 2022
2fb43e1
Merge pull request #16658 from github/repo-sync
Octomerger Mar 29, 2022
c32a5ab
update beta note (#26493)
mchammer01 Mar 29, 2022
ad4ce69
update link (#26490)
skedwards88 Mar 29, 2022
3b6dfd3
Merge branch 'main' into dependabot/npm_and_yarn/minimist-1.2.6
heiskr Mar 29, 2022
d9db45d
Add flags (#26429)
mattpollard Mar 29, 2022
2bd82c4
Fix broken links for GitHub AE (#26424)
mattpollard Mar 29, 2022
ea800e5
Enterprise bug fixes for the week of 2022-03-21 (#26374)
lecoursen Mar 29, 2022
9137460
Merge branch 'main' into repo-sync
Octomerger Mar 29, 2022
9e7cc52
Merge pull request #16659 from github/repo-sync
Octomerger Mar 29, 2022
f4ffd37
Merge branch 'main' into dependabot/npm_and_yarn/minimist-1.2.6
heiskr Mar 29, 2022
ae85724
Remove GitHub Mobile for GHES beta disclaimer (#26486)
eliperkins Mar 29, 2022
9bb36a1
remove Insights-specific logic and update comment (#26483)
sarahs Mar 29, 2022
f54a2c3
only run build-and-push-nonprod-cache in upstream repos (#26459)
peterbe Mar 29, 2022
bcddc37
Merge branch 'main' into repo-sync
Octomerger Mar 29, 2022
6d28aa5
Merge pull request #16660 from github/repo-sync
Octomerger Mar 29, 2022
4a4895e
don't throw on missing data tags in search sync (#26487)
peterbe Mar 29, 2022
7531110
delete some orphan assets (#26500)
peterbe Mar 29, 2022
829754a
delete more orphan assets (#26501)
peterbe Mar 29, 2022
74b0fcf
upgrade typescript-eslint combo 5.16.0 (#26502)
peterbe Mar 29, 2022
7f78eb2
Merge branch 'main' into repo-sync
Octomerger Mar 29, 2022
b345885
Clarify check_suite relation to its parent pull_request (#26432)
Mar 29, 2022
9f657b4
Merge pull request #16661 from github/repo-sync
Octomerger Mar 29, 2022
6dfa8ca
pull lfs files in Codespaces (#26522)
peterbe Mar 29, 2022
d31987b
Merge branch 'main' into dependabot/npm_and_yarn/minimist-1.2.6
gracepark Mar 29, 2022
d4984a4
Merge pull request #26528 from github/dependabot/npm_and_yarn/minimis…
heiskr Mar 29, 2022
9aebde9
Merge branch 'main' into repo-sync
Octomerger Mar 29, 2022
d1a0b3f
Merge pull request #16662 from github/repo-sync
Octomerger Mar 29, 2022
7f3b259
Rest required previews are deprecated (#26527)
rachmari Mar 29, 2022
622eda0
change error codes table to all status codes table (#26518)
rachmari Mar 29, 2022
43f0e52
remove GHEC signup button for dotcom_user cookied users (#26521)
peterbe Mar 29, 2022
f2519a8
Merge branch 'main' into repo-sync
Octomerger Mar 29, 2022
810bd77
not all tests need LFS (#26524)
peterbe Mar 29, 2022
916dc90
Merge pull request #16663 from github/repo-sync
Octomerger Mar 29, 2022
bf65246
re-instate the 'linting' test group (#26525)
peterbe Mar 29, 2022
f4884a3
Merge branch 'main' into repo-sync
Octomerger Mar 29, 2022
7f267fc
Merge pull request #16665 from github/repo-sync
Octomerger Mar 29, 2022
fb3a4bd
disable changelog feed download in sync-search (#26489)
peterbe Mar 30, 2022
9357fa8
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
1f7079c
Merge pull request #16668 from github/repo-sync
Octomerger Mar 30, 2022
cb945d4
update search indexes
actions-user Mar 30, 2022
066a7db
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
5f1e1a7
Merge pull request #16670 from github/repo-sync
Octomerger Mar 30, 2022
e8329c4
Add Actions policy for reusable workflows (#26287)
lucascosti Mar 30, 2022
9ded9b3
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
299a209
Add release note for mobile enabled flag change in GHES 3.4.0 (#26443)
eliperkins Mar 30, 2022
1ba0379
Merge pull request #16672 from github/repo-sync
Octomerger Mar 30, 2022
c4dbed8
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
3f415c1
Merge pull request #16674 from github/repo-sync
Octomerger Mar 30, 2022
2bbe4a1
Update working-with-non-code-files.md (#26364)
davidstaheli Mar 30, 2022
9419e06
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
9a9106e
Merge pull request #16678 from github/repo-sync
Octomerger Mar 30, 2022
a46e764
update search indexes
actions-user Mar 30, 2022
bc4d5f2
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
d230c40
Merge pull request #16680 from github/repo-sync
Octomerger Mar 30, 2022
3ac7733
'needs SME' label automation (#26078)
ramyaparimi Mar 30, 2022
2b873fd
Update OpenAPI Descriptions (#26544)
github-openapi-bot Mar 30, 2022
9ba21a5
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
7d99599
Merge pull request #16684 from github/repo-sync
Octomerger Mar 30, 2022
bd57e25
don't send response headers if response is done (#26550)
peterbe Mar 30, 2022
1aa1223
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
f098474
Merge pull request #16686 from github/repo-sync
Octomerger Mar 30, 2022
8134bd7
Merge branch 'main' into patch-3
ramyaparimi Mar 30, 2022
6a61200
Merge pull request #14915 from nikola-jokic/patch-3
ramyaparimi Mar 30, 2022
b02b0bf
Merge branch 'main' into sophietheking/fixlink
sophietheking Mar 30, 2022
ba7c2c0
Merge pull request #26482 from github/sophietheking/fixlink
sophietheking Mar 30, 2022
a4b6ddf
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
cd44ac8
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
c2c1213
Merge pull request #16687 from github/repo-sync
Octomerger Mar 30, 2022
7cbc56c
Merge pull request #26557 from github/repo-sync
Octomerger Mar 30, 2022
9e60aad
Merge branch 'main' into patch-5
ramyaparimi Mar 30, 2022
c22772f
Merge pull request #15768 from nikola-jokic/patch-5
ramyaparimi Mar 30, 2022
1a028ce
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
347a170
sitedata per translation (#26496)
peterbe Mar 30, 2022
a53c007
Merge pull request #16688 from github/repo-sync
Octomerger Mar 30, 2022
0ecf92f
Merge branch 'main' into patch-2
ramyaparimi Mar 30, 2022
fdfbc38
Merge pull request #15977 from martindevnow/patch-2
ramyaparimi Mar 30, 2022
3668fd9
Merge branch 'main' into patch-4
ramyaparimi Mar 30, 2022
0acfb54
Merge pull request #16275 from nikola-jokic/patch-4
ramyaparimi Mar 30, 2022
679e5f8
Fix typo in two URLs (#26559)
felicitymay Mar 30, 2022
03c5059
Merge branch 'main' into patch-2
ramyaparimi Mar 30, 2022
a371d46
Merge pull request #16283 from SpraxDev/patch-2
ramyaparimi Mar 30, 2022
c7741bc
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
7bf9561
Merge pull request #16689 from github/repo-sync
Octomerger Mar 30, 2022
128661d
Merge branch 'main' into curl-parameter
ramyaparimi Mar 30, 2022
d782a66
Merge pull request #16528 from gijswijs/curl-parameter
ramyaparimi Mar 30, 2022
3fb430a
[2022-03-30]: Running scripts before or after a job (Public Beta) (#2…
Mar 30, 2022
72c291b
more patience for signup-button rendering tests (#26560)
peterbe Mar 30, 2022
c7ac337
Merge branch 'main' into patch-2
ramyaparimi Mar 30, 2022
d191408
notes about data location policy (#26495)
vtbassmatt Mar 30, 2022
72faae2
Merge pull request #16541 from mathias/patch-2
ramyaparimi Mar 30, 2022
a8e2a02
Merge branch 'main' into repo-sync
Octomerger Mar 30, 2022
546a0ca
Merge pull request #16690 from github/repo-sync
Octomerger Mar 30, 2022
3f21935
Merge branch 'main' into lorensr-patch-1
ramyaparimi Mar 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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