Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import { createContext, useContext } from 'react'
import type { MiniTocItem } from 'components/context/ArticleContext'

export type RestContextT = {
export type AutomatedPageContextT = {
title: string
intro: string
renderedPage: string | JSX.Element[]
miniTocItems: Array<MiniTocItem>
}

export const RestContext = createContext<RestContextT | null>(null)
export const AutomatedPageContext = createContext<AutomatedPageContextT | null>(null)

export const useRestContext = (): RestContextT => {
const context = useContext(RestContext)
export const useAutomatedPageContext = (): AutomatedPageContextT => {
const context = useContext(AutomatedPageContext)

if (!context) {
throw new Error('"useRestContext" may only be used inside "RestContext.Provider"')
throw new Error(
'"useAutomatedPageContext" may only be used inside "AutomatedPageContext.Provider"'
)
}

return context
}

export const getRestContextFromRequest = (req: any): RestContextT => {
export const getAutomatedPageContextFromRequest = (req: any): AutomatedPageContextT => {
const page = req.context.page

return {
Expand Down
2 changes: 1 addition & 1 deletion components/homepage/ProductSelectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const ProductSelectionCard = ({ name, group }: ProductSelectionCardProps)
{icon(group)}

<div>
<h3>{name}</h3>
<h2 className="h3">{name}</h2>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions components/rest/RestReferencePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MarkdownContent } from 'components/ui/MarkdownContent'
import { Lead } from 'components/ui/Lead'
import { RestOperation } from './RestOperation'
import styles from './RestOperation.module.scss'
import { useRestContext } from 'components/context/RestContext'
import { useAutomatedPageContext } from 'components/context/AutomatedPageContext'
import { Operation } from './types'

const ClientSideHighlightJS = dynamic(() => import('components/article/ClientSideHighlightJS'), {
Expand All @@ -28,7 +28,7 @@ export type StructuredContentT = {

export const RestReferencePage = ({ restOperations }: StructuredContentT) => {
const { asPath } = useRouter()
const { title, intro, renderedPage } = useRestContext()
const { title, intro, renderedPage } = useAutomatedPageContext()
// 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.
Expand Down
4 changes: 2 additions & 2 deletions components/sidebar/RestCollapsibleSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ActionList } from '@primer/react'
import { Link } from 'components/Link'
import { ProductTreeNode } from 'components/context/MainContext'
import { EventType, sendEvent } from 'components/lib/events'
import { useRestContext } from 'components/context/RestContext'
import { useAutomatedPageContext } from 'components/context/AutomatedPageContext'
import type { MiniTocItem } from 'components/context/ArticleContext'
import styles from './SidebarProduct.module.scss'

Expand Down Expand Up @@ -47,7 +47,7 @@ export const RestCollapsibleSection = (props: SectionProps) => {
router.asPath.includes('/rest/guides') ||
router.asPath.includes('/rest/overview')
? []
: useRestContext().miniTocItems
: useAutomatedPageContext().miniTocItems

useEffect(() => {
if (!currentAnchor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ If you have many dependencies to manage, you may want to customize the configura

By default, {% data variables.product.prodname_dependabot %} automatically rebases pull requests to resolve any conflicts. If you'd prefer to handle merge conflicts manually, you can disable this using the `rebase-strategy` option. For details, see "[Configuration options for the dependabot.yml file](/github/administering-a-repository/configuration-options-for-dependency-updates#rebase-strategy)."

## Allowing {% data variables.product.prodname_dependabot %} to rebase and force push over extra commits

By default, {% data variables.product.prodname_dependabot %} will stop rebasing a pull request once extra commits have been pushed to it. To allow {% data variables.product.prodname_dependabot %} to force push over commits added to its branches, include any of the following strings: `[dependabot skip]` , `[skip dependabot]`, `[dependabot-skip]`, or `[skip-dependabot]`, in either lower or uppercase, to the commit message.

## Managing {% data variables.product.prodname_dependabot %} pull requests with comment commands

{% data variables.product.prodname_dependabot %} responds to simple commands in comments. Each pull request contains details of the commands you can use to process the pull request (for example: to merge, squash, reopen, close, or rebase the pull request) under the "{% data variables.product.prodname_dependabot %} commands and options" section. The aim is to make it as easy as possible for you to triage these automatically generated pull requests.
Expand Down
20 changes: 10 additions & 10 deletions pages/[versionId]/rest/[category]/[subcategory].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Operation } from 'components/rest/types'
import { RestReferencePage } from 'components/rest/RestReferencePage'
import { getMainContext, MainContext, MainContextT } from 'components/context/MainContext'
import {
RestContext,
RestContextT,
getRestContextFromRequest,
} from 'components/context/RestContext'
AutomatedPageContext,
AutomatedPageContextT,
getAutomatedPageContextFromRequest,
} from 'components/context/AutomatedPageContext'
import type { MiniTocItem } from 'components/context/ArticleContext'

type MinitocItemsT = {
Expand All @@ -16,16 +16,16 @@ type MinitocItemsT = {

type Props = {
mainContext: MainContextT
restContext: RestContextT
automatedPageContext: AutomatedPageContextT
restOperations: Operation[]
}

export default function SubCategory({ mainContext, restContext, restOperations }: Props) {
export default function SubCategory({ mainContext, automatedPageContext, restOperations }: Props) {
return (
<MainContext.Provider value={mainContext}>
<RestContext.Provider value={restContext}>
<AutomatedPageContext.Provider value={automatedPageContext}>
<RestReferencePage restOperations={restOperations} />
</RestContext.Provider>
</AutomatedPageContext.Provider>
</MainContext.Provider>
)
}
Expand All @@ -50,7 +50,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (context) =>
// Gets the miniTocItems in the article context. At this point it will only
// include miniTocItems generated from the Markdown pages in
// content/rest/*
const { miniTocItems } = getRestContextFromRequest(req)
const { miniTocItems } = getAutomatedPageContextFromRequest(req)

// When operations exist, update the miniTocItems in the article context
// with the list of operations in the OpenAPI.
Expand All @@ -75,7 +75,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (context) =>
props: {
restOperations,
mainContext: getMainContext(req, res),
restContext: getRestContextFromRequest(req),
automatedPageContext: getAutomatedPageContextFromRequest(req),
},
}
}
20 changes: 10 additions & 10 deletions pages/[versionId]/rest/[category]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Operation } from 'components/rest/types'
import { RestReferencePage } from 'components/rest/RestReferencePage'
import { getMainContext, MainContext, MainContextT } from 'components/context/MainContext'
import {
RestContext,
RestContextT,
getRestContextFromRequest,
} from 'components/context/RestContext'
AutomatedPageContext,
AutomatedPageContextT,
getAutomatedPageContextFromRequest,
} from 'components/context/AutomatedPageContext'
import type { MiniTocItem } from 'components/context/ArticleContext'
import {
getTocLandingContextFromRequest,
Expand All @@ -25,21 +25,21 @@ type MinitocItemsT = {
type Props = {
mainContext: MainContextT
tocLandingContext: TocLandingContextT
restContext: RestContextT
automatedPageContext: AutomatedPageContextT
restOperations: Operation[]
}

export default function Category({
mainContext,
restContext,
automatedPageContext,
tocLandingContext,
restOperations,
}: Props) {
const { relativePath } = mainContext

return (
<MainContext.Provider value={mainContext}>
<RestContext.Provider value={restContext}>
<AutomatedPageContext.Provider value={automatedPageContext}>
{/* When the page is the rest product landing page, we don't want to
render the rest-specific sidebar because toggling open the categories
won't have the minitoc items at that level. These are pages that have
Expand All @@ -51,7 +51,7 @@ export default function Category({
) : (
<RestReferencePage restOperations={restOperations} />
)}
</RestContext.Provider>
</AutomatedPageContext.Provider>
</MainContext.Provider>
)
}
Expand Down Expand Up @@ -165,7 +165,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (context) =>
// Gets the miniTocItems in the article context. At this point it will only
// include miniTocItems generated from the Markdown pages in
// content/rest/*
const { miniTocItems } = getRestContextFromRequest(req)
const { miniTocItems } = getAutomatedPageContextFromRequest(req)

// When operations exist, update the miniTocItems in the article context
// with the list of operations in the OpenAPI.
Expand Down Expand Up @@ -194,7 +194,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (context) =>
props: {
restOperations,
mainContext: getMainContext(req, res),
restContext: getRestContextFromRequest(req),
automatedPageContext: getAutomatedPageContextFromRequest(req),
tocLandingContext,
},
}
Expand Down