Skip to content

Commit

Permalink
merge and fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
gracepark committed Jun 22, 2021
2 parents ee58981 + b24fe62 commit 23f586b
Show file tree
Hide file tree
Showing 82 changed files with 978 additions and 475 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/move-new-issues-to-correct-docs-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
owner: owner,
repo: originalRepo,
issue_number: issueNo,
body: `👋 Moving forward, we're asking that folks create all new Docs issues in the [${process.env.TEAM_ENGINEERING_REPO}](${process.env.TEAM_ENGINEERING_REPO}) repo and all new content issues in [${process.env.TEAM_CONTENT_REPO}](${process.env.TEAM_CONTENT_REPO}). We transferred it for you!`
body: `👋 You opened this issue in `${context.repo.repo}`. Moving forward, we're asking that folks create new issues in the following repositories instead:\n- For issues with the docs site, please submit to the [${process.env.TEAM_ENGINEERING_REPO}](/${owner}/${process.env.TEAM_ENGINEERING_REPO}) repo.\n- For all new content issues, please submit to the [${process.env.TEAM_CONTENT_REPO}](/${owner}/${process.env.TEAM_CONTENT_REPO}) repo.\n\nWe will transfer this issue for you!`
})
// Transfer the issue to the correct repo
Expand Down
4 changes: 1 addition & 3 deletions components/DefaultLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useTranslation } from './hooks/useTranslation'

type Props = { children?: React.ReactNode }
export const DefaultLayout = (props: Props) => {
const { builtAssets, page, error, isHomepageVersion } = useMainContext()
const { page, error, isHomepageVersion } = useMainContext()
const { t } = useTranslation('errors')
return (
<div className="d-lg-flex">
Expand All @@ -22,8 +22,6 @@ export const DefaultLayout = (props: Props) => {
<title>{page.fullTitle}</title>
) : null}

<script src={builtAssets.main.js} />

{/* For Google and Bots */}
{page.introPlainText && <meta name="description" content={page.introPlainText} />}

Expand Down
2 changes: 1 addition & 1 deletion components/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useMainContext } from 'components/context/MainContext'

const { NODE_ENV } = process.env

const enableNextLinks = false
const enableNextLinks = true

type Props = { locale?: string } & ComponentProps<'a'>
export function Link(props: Props) {
Expand Down
16 changes: 16 additions & 0 deletions components/PrintAction.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'

type Props = {
children: React.ReactElement
}
export function PrintAction({ children }: Props) {
const onClick = () => {
try {
document.execCommand('print', false)
} catch (e) {
window.print()
}
}

return React.cloneElement(React.Children.only(children), { onClick })
}
4 changes: 3 additions & 1 deletion components/Survey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ export const Survey = () => {
</>
)}

{state === ViewState.END && <p className="color-text-secondary f6" data-testid="survey-end">{t`feedback`}</p>}
{state === ViewState.END && (
<p className="color-text-secondary f6" data-testid="survey-end">{t`feedback`}</p>
)}
</form>
)
}
Expand Down
19 changes: 7 additions & 12 deletions components/article/ArticleTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Tooltip } from '@primer/components'
import { PrinterIcon } from './PrinterIcon'

import { PrintAction } from 'components/PrintAction'

type Props = {
children: React.ReactNode
}
Expand All @@ -10,18 +12,11 @@ export const ArticleTitle = ({ children }: Props) => {
<h1 className="my-4 border-bottom-0">{children}</h1>
<div className="d-none d-lg-block ml-2">
<Tooltip aria-label="Print this article" noDelay direction="n">
<button
className="btn-link Link--muted"
onClick={() => {
try {
document.execCommand('print', false)
} catch (e) {
window.print()
}
}}
>
<PrinterIcon />
</button>
<PrintAction>
<button className="btn-link Link--muted">
<PrinterIcon />
</button>
</PrintAction>
</Tooltip>
</div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions components/context/MainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export type MainContextT = {
maptopic?: BreadcrumbT
article?: BreadcrumbT
}
builtAssets: { main: { js: string } }
activeProducts: Array<ProductT>
currentProduct?: ProductT
currentLayoutName: string
Expand Down Expand Up @@ -112,7 +111,6 @@ export type MainContextT = {

export const getMainContextFromRequest = (req: any): MainContextT => {
return {
builtAssets: { main: { js: req.context.builtAssets.main.js } },
breadcrumbs: req.context.breadcrumbs || {},
activeProducts: req.context.activeProducts,
currentProduct: req.context.productMap[req.context.currentProduct] || null,
Expand Down
2 changes: 1 addition & 1 deletion components/context/ProductSubLandingContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const getProductSubLandingContextFromRequest = (req: any): ProductSubLand
includeGuides: (page.includeGuides || []).map((guide: any) => {
return {
...pick(guide, ['href', 'title', 'intro', 'topics']),
type: guide.type || ''
type: guide.type || '',
}
}),
}
Expand Down
5 changes: 4 additions & 1 deletion components/release-notes/GHESReleaseNotePatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { PatchNotes } from './PatchNotes'
import { Link } from 'components/Link'
import { CurrentVersion, ReleaseNotePatch, GHESMessage } from './types'
import { useOnScreen } from 'components/hooks/useOnScreen'
import { PrintAction } from 'components/PrintAction'

type Props = {
patch: ReleaseNotePatch
Expand Down Expand Up @@ -65,7 +66,9 @@ export function GHESReleaseNotePatch({
</Link>
)}

<button className="js-print btn-link ml-3 text-small text-bold">Print</button>
<PrintAction>
<button className="btn-link ml-3 text-small text-bold">Print</button>
</PrintAction>
</div>

<p className="color-text-secondary mt-1">{dayjs(patch.date).format('MMMM, DD, YYYY')}</p>
Expand Down
4 changes: 3 additions & 1 deletion components/sublanding/ArticleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export const ArticleCard = ({ card, typeLabel }: Props) => {
<div data-testid="article-card" className="d-flex col-12 col-md-4 pr-0 pr-md-6 pr-lg-8">
<a className="no-underline d-flex flex-column py-3 border-bottom" href={card.href}>
<h4 className="h4 color-text-primary mb-1">{card.title}</h4>
<div className="h6 text-uppercase" data-testid="article-card-type">{typeLabel}</div>
<div className="h6 text-uppercase" data-testid="article-card-type">
{typeLabel}
</div>
<p className="color-text-secondary my-3">{card.intro}</p>
{card.topics.length > 0 && (
<div>
Expand Down
48 changes: 25 additions & 23 deletions components/sublanding/LearningTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ type Props = {
track: FeaturedTrack
}

const MAX_VISIBLE_GUIDES = 4
const DEFAULT_VISIBLE_GUIDES = 4
export const LearningTrack = ({ track }: Props) => {
const [visibleGuides, setVisibleGuides] = useState(track?.guides?.slice(0, 4))
const [numVisible, setNumVisible] = useState(DEFAULT_VISIBLE_GUIDES)
const showAll = () => {
setVisibleGuides(track?.guides)
setNumVisible(track?.guides?.length || 0)
}
const { t } = useTranslation('product_sublanding')

return (
<div className="my-3 px-4 col-12 col-md-6 learning-track">
<div className="Box js-show-more-container d-flex flex-column">
<div className="Box d-flex flex-column">
<div className="Box-header bg-gradient--blue-pink p-4 d-flex flex-1 flex-items-start flex-wrap">
<div className="d-flex flex-auto flex-items-start col-8 col-md-12 col-xl-8">
<div className="my-xl-0 mr-xl-3">
Expand All @@ -38,10 +38,11 @@ export const LearningTrack = ({ track }: Props) => {
</span>
</a>
</div>
{visibleGuides?.map((guide) => (
<div>

{track?.guides?.slice(0, numVisible).map((guide) => (
<div key={guide.href + track?.trackName}>
<a
className="Box-row d-flex flex-items-center color-text-primary no-underline js-show-more-item"
className="Box-row d-flex flex-items-center color-text-primary no-underline"
href={`${guide.href}?learn=${track?.trackName}`}
>
<div className="circle color-bg-tertiary d-inline-flex mr-4">
Expand All @@ -56,24 +57,25 @@ export const LearningTrack = ({ track }: Props) => {
{t('guide_types')[guide.page?.type || '']}
</div>
</a>
{track?.guides && track?.guides?.indexOf(guide) + 1 === MAX_VISIBLE_GUIDES ? (
<button
className="Box-footer btn-link border-top-0 position-relative text-center text-bold color-text-link pt-1 pb-3 col-12 js-show-more-button"
onClick={showAll}
>
<div
className="position-absolute left-0 right-0 py-5 fade-background-bottom"
style={{ bottom: '50px' }}
></div>
<span>
Show {track?.guides?.length - MAX_VISIBLE_GUIDES} {t(`more_guides`)}
</span>
</button>
) : (
<div />
)}
</div>
))}

{(track?.guides?.length || 0) > numVisible ? (
<button
className="Box-footer btn-link border-top-0 position-relative text-center text-bold color-text-link pt-1 pb-3 col-12"
onClick={showAll}
>
<div
className="position-absolute left-0 right-0 py-5 fade-background-bottom"
style={{ bottom: '50px' }}
></div>
<span>
Show {(track?.guides?.length || 0) - numVisible} {t(`more_guides`)}
</span>
</button>
) : (
<div />
)}
</div>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion components/sublanding/SubLandingHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const SubLandingHero = () => {
const { t } = useTranslation('product_sublanding')

const guideItems = featuredTrack?.guides?.map((guide) => (
<li className="px-2 d-flex flex-shrink-0">
<li className="px-2 d-flex flex-shrink-0" key={guide.href}>
<Link
href={`${guide.href}?learn=${featuredTrack.trackName}`}
className="d-inline-block Box p-5 color-bg-primary color-border-primary no-underline"
Expand Down
12 changes: 6 additions & 6 deletions content/actions/reference/authentication-in-a-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ jobs:
issues: write {% endif %}
steps:
- name: Create issue using REST API
run: {% raw %}|
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--url {% data variables.product.api_url_code %}/repos/${% raw %}{{ github.repository }}{% endraw %}/issues \
--header 'authorization: Bearer ${% raw %}{{ secrets.GITHUB_TOKEN }}{% endraw %}' \
--header 'content-type: application/json' \
--data '{
"title": "Automated issue for commit: ${{ github.sha }}",
"body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_."
"title": "Automated issue for commit: ${% raw %}{{ github.sha }}{% endraw %}",
"body": "This issue was automatically created by the GitHub Action workflow **${% raw %}{{ github.workflow }}{% endraw %}**. \n\n The commit hash was: _${% raw %}{{ github.sha }}{% endraw %}_."
}' \
--fail{% endraw %}
--fail
```

## Permissions for the `GITHUB_TOKEN`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ You must have administrative access on your IdP to configure the application for

| Value | Other names | Description | Example |
| :- | :- | :- | :- |
| URL | Tenant URL | URL to the SCIM provisioning API for your enterprise on {% data variables.product.prodname_ghe_managed %} | <pre>https&colon;//api.<em>YOUR-GITHUB-AE-HOSTNAME</em>/scim/v2</pre> |
| URL | Tenant URL | URL to the SCIM provisioning API for your enterprise on {% data variables.product.prodname_ghe_managed %} | <nobr><code>{% data variables.product.api_url_pre %}</nobr></code> |
| Shared secret | Personal access token, secret token | Token for application on your IdP to perform provisioning tasks on behalf of an enterprise owner | Personal access token you created in step 1 |

{% endif %}
3 changes: 2 additions & 1 deletion content/code-security/guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ includeGuides:
- /code-security/secure-coding/integrating-with-code-scanning/sarif-support-for-code-scanning
- /code-security/secure-coding/integrating-with-code-scanning/uploading-a-sarif-file-to-github
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/about-codeql-code-scanning-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-runner-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-cli-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-runner-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/troubleshooting-codeql-runner-in-your-ci-system
- /code-security/security-advisories/about-coordinated-disclosure-of-security-vulnerabilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ topics:
If you're setting up {% data variables.product.prodname_code_scanning %} for a compiled language, and you're building the code in a containerized environment, the analysis may fail with the error message "No source code was seen during the build." This indicates that {% data variables.product.prodname_codeql %} was unable to monitor your code as it was compiled.

{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "[email protected]" or currentVersion == "github-ae@next" %}
You must run {% data variables.product.prodname_codeql %} inside the container in which you build your code. This applies whether you are using the {% data variables.product.prodname_codeql_cli %}, the {% data variables.product.prodname_codeql_runner %}, or {% data variables.product.prodname_actions %}. For the {% data variables.product.prodname_codeql_cli %} or the {% data variables.product.prodname_codeql_runner %}, see "[Running {% data variables.product.prodname_codeql_cli %} in your CI system](/code-security/secure-coding/running-codeql-cli-in-your-ci-system)" or "[Running {% data variables.product.prodname_codeql_runner %} in your CI system](/code-security/secure-coding/running-codeql-runner-in-your-ci-system)" for more information. If you're using {% data variables.product.prodname_actions %}, configure your workflow to run all the actions in the same container. For more information, see "[Example workflow](#example-workflow)."
You must run {% data variables.product.prodname_codeql %} inside the container in which you build your code. This applies whether you are using the {% data variables.product.prodname_codeql_cli %}, the {% data variables.product.prodname_codeql_runner %}, or {% data variables.product.prodname_actions %}. For the {% data variables.product.prodname_codeql_cli %} or the {% data variables.product.prodname_codeql_runner %}, see "[Installing {% data variables.product.prodname_codeql_cli %} in your CI system](/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system)" or "[Running {% data variables.product.prodname_codeql_runner %} in your CI system](/code-security/secure-coding/running-codeql-runner-in-your-ci-system)" for more information. If you're using {% data variables.product.prodname_actions %}, configure your workflow to run all the actions in the same container. For more information, see "[Example workflow](#example-workflow)."
{% else %}
You must run {% data variables.product.prodname_codeql %} inside the container in which you build your code. This applies whether you are using the {% data variables.product.prodname_codeql_runner %} or {% data variables.product.prodname_actions %}. For the {% data variables.product.prodname_codeql_runner %}, see "[Running {% data variables.product.prodname_codeql_runner %} in your CI system](/code-security/secure-coding/running-codeql-runner-in-your-ci-system)" for more information. If you're using {% data variables.product.prodname_actions %}, configure your workflow to run all the actions in the same container. For more information, see "[Example workflow](#example-workflow)."
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ To upload a SARIF file from a third-party static code analysis engine, you'll ne
If you're using {% data variables.product.prodname_actions %} with the {% data variables.product.prodname_codeql_workflow %} or using the {% data variables.product.prodname_codeql_runner %}, then the {% data variables.product.prodname_code_scanning %} results will automatically use the supported subset of SARIF 2.1.0. For more information, see "[Setting up {% data variables.product.prodname_code_scanning %} for a repository](/code-security/secure-coding/setting-up-code-scanning-for-a-repository)" or "[Running {% data variables.product.prodname_codeql_runner %} in your CI system](/code-security/secure-coding/running-codeql-runner-in-your-ci-system)."

{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "[email protected]" or currentVersion == "github-ae@next" %}
If you're using the {% data variables.product.prodname_codeql_cli %}, then you can specify the version of SARIF to use. For more information, see "[Running {% data variables.product.prodname_codeql_cli %} in your CI system](/code-security/secure-coding/running-codeql-cli-in-your-ci-system#uploading-results-to-github)."{% endif %}
If you're using the {% data variables.product.prodname_codeql_cli %}, then you can specify the version of SARIF to use. For more information, see "[Configuring {% data variables.product.prodname_codeql_cli %} in your CI system](/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system#analyzing-a-codeql-database)."{% endif %}

{% if currentVersion == "free-pro-team@latest" %}
You can upload multiple SARIF files for the same tool and commit, and analyze each file using {% data variables.product.prodname_code_scanning %}. You can indicate a "category" for each analysis by specifying a `runAutomationDetails.id` in each file. Only SARIF files with the same category will overwrite each other. For more information about this property, see [`runAutomationDetails` object](#runautomationdetails-object) below.
Expand Down
Loading

0 comments on commit 23f586b

Please sign in to comment.