Skip to content

Commit

Permalink
Merge branch 'main' into docs-correct-sprint-word
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwilson21 authored Sep 28, 2022
2 parents 327190b + a06da21 commit 4ac5bae
Show file tree
Hide file tree
Showing 425 changed files with 12,784 additions and 5,440 deletions.
56 changes: 52 additions & 4 deletions .github/workflows/dry-run-elasticsearch-indexing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
merge_group:
pull_request:
paths:
- script/search/index-elasticsearch.js
- 'script/search/**'
- 'package*.json'
- .github/workflows/dry-run-elasticsearch-indexing.yml

Expand Down Expand Up @@ -46,9 +46,57 @@ jobs:
node-version: 16.15.x
cache: npm

- name: Install
- 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 scripts
run: npm run build

- name: Start the server in the background
env:
ENABLE_DEV_LOGGING: false
run: |
npm run sync-search-server > /tmp/stdout.log 2> /tmp/stderr.log &
# first sleep to give it a chance to start
sleep 6
curl --retry-connrefused --retry 4 -I http://localhost:4002/
- if: ${{ failure() }}
name: Debug server outputs on errors
run: |
echo "____STDOUT____"
cat /tmp/stdout.log
echo "____STDERR____"
cat /tmp/stderr.log
- name: Scrape records into a temp directory
env:
# 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: |
mkdir /tmp/records
npm run sync-search-indices -- \
--language en \
--version dotcom \
--out-directory /tmp/records \
--no-compression --no-lunr-index
ls -lh /tmp/records
# Serves two purposes;
# 1. Be confident that the Elasticsearch server start-up worked at all
# 2. Sometimes Elasticsearch will bind to the port but still not
Expand All @@ -62,8 +110,8 @@ jobs:
ELASTICSEARCH_URL: 'http://localhost:9200'
run: |
./script/search/index-elasticsearch.js --verbose \
-l en -l ja \
-V dotcom -V ghes-3.5
-l en \
-V dotcom -- /tmp/records
- name: Show created indexes and aliases
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/sync-search-elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ jobs:
- name: Index into Elasticsearch
run: |
./script/search/index-elasticsearch.js \
--language ${{ matrix.language }} \
--source-directory /tmp/records
--language ${{ matrix.language }} -- /tmp/records
- name: Check created indexes and aliases
run: |
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.
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.
17 changes: 15 additions & 2 deletions components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,23 @@ function ShowSearchResults({
</p>

<ActionList variant="full">
{results.map(({ url, breadcrumbs, title, content, score, popularity }) => {
{results.map(({ url, breadcrumbs, title, content, score, popularity }, index) => {
return (
<ActionList.Item className="width-full" key={url}>
<Link href={url} className="no-underline color-fg-default">
<Link
href={url}
className="no-underline color-fg-default"
onClick={() => {
sendEvent({
type: EventType.searchResult,
search_result_query: Array.isArray(query) ? query[0] : query,
search_result_index: index,
search_result_total: results.length,
search_result_rank: (results.length - index) / results.length,
search_result_url: url,
})
}}
>
<div
data-testid="search-result"
className={cx('list-style-none', styles.resultsContainer)}
Expand Down
8 changes: 5 additions & 3 deletions components/guides/ArticleCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ArticleGuide } from 'components/context/ProductGuidesContext'
import { Label } from '@primer/react'

import { ArticleGuide } from 'components/context/ProductGuidesContext'
import { Link } from 'components/Link'

type Props = {
card: ArticleGuide
typeLabel: string
Expand All @@ -14,7 +16,7 @@ export const ArticleCard = ({ tabIndex, card, typeLabel }: Props) => {
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}>
<Link className="no-underline d-flex flex-column py-3 border-bottom" href={card.href}>
<h3 className="h4 color-fg-default mb-1" dangerouslySetInnerHTML={{ __html: card.title }} />
<div className="h6 text-uppercase" data-testid="article-card-type">
{typeLabel}
Expand All @@ -38,7 +40,7 @@ export const ArticleCard = ({ tabIndex, card, typeLabel }: Props) => {
})}
</ul>
)}
</a>
</Link>
</li>
)
}
9 changes: 5 additions & 4 deletions components/guides/LearningTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FeaturedTrack } from 'components/context/ProductGuidesContext'
import { TruncateLines } from 'components/ui/TruncateLines'
import slugger from 'github-slugger'
import styles from './LearningTrack.module.scss'
import { Link } from 'components/Link'

type Props = {
track: FeaturedTrack
Expand Down Expand Up @@ -37,7 +38,7 @@ export const LearningTrack = ({ track }: Props) => {
</TruncateLines>
</div>
</div>
<a
<Link
{...{ 'aria-label': `${track?.title} - ${t('start_path')}` }}
className="d-inline-flex btn no-wrap mt-3 mt-md-0 flex-items-center flex-justify-center"
href={`${track?.guides && track?.guides[0].href}?learn=${
Expand All @@ -46,7 +47,7 @@ export const LearningTrack = ({ track }: Props) => {
>
<span>{t('start_path')}</span>
<ArrowRightIcon size={20} className="ml-2" />
</a>
</Link>
</div>

{track && track.guides && (
Expand Down Expand Up @@ -81,7 +82,7 @@ export const LearningTrack = ({ track }: Props) => {
},
}}
>
<a
<Link
className="rounded-0 pl-7 py-4 width-full d-block Box-row d-flex flex-items-center color-fg-default no-underline"
href={`${guide.href}?learn=${track?.trackName}&learnProduct=${track?.trackProduct}`}
>
Expand All @@ -92,7 +93,7 @@ export const LearningTrack = ({ track }: Props) => {
<div className="color-fg-muted h6 text-uppercase flex-shrink-0">
{t('guide_types')[guide.page?.type || '']}
</div>
</a>
</Link>
</ActionList.Item>
)
})}
Expand Down
2 changes: 1 addition & 1 deletion components/lib/get-rest-code-samples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function getShellExample(operation: Operation, codeSample: CodeSample) {

const args = [
operation.verb !== 'get' && `-X ${operation.verb.toUpperCase()}`,
`-H "Accept: ${defaultAcceptHeader}" \\ \n ${authHeader}`,
`-H "Accept: ${defaultAcceptHeader}" \\\n ${authHeader}`,
`${operation.serverUrl}${requestPath}`,
requestBodyParams,
].filter(Boolean)
Expand Down
8 changes: 7 additions & 1 deletion components/parameter-table/ParameterTable.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.parameterTable {
// this is for the child parameter table row that contiains the top level
// this is for the child parameter table row that contains the top level
// properties details toggle element because we want it to match the
// background color of the top level parameter rows. We need the !important
// because the child parameter rows (the nested expanded properties) otherwise
Expand All @@ -17,4 +17,10 @@
padding-left: 0px !important;
margin-bottom: 4px !important;
}

& > tbody > tr > td > * {
width: auto;
display: block;
word-break: break-word;
}
}
1 change: 1 addition & 0 deletions components/search/SearchError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function SearchError({ error }: Props) {
{process.env.NODE_ENV === 'development' && <code>{error.toString()}</code>}
</Flash>
<Box>
{/* This deliberately uses a <a> instead of <Link> so it triggers a full reload. */}
<a href={`/${locale}${asPath}`}>Try reloading the page</a>
</Box>
</div>
Expand Down
43 changes: 37 additions & 6 deletions components/search/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import type { SearchResultsT, SearchResultHitT } from './types'
import { useTranslation } from 'components/hooks/useTranslation'
import { Link } from 'components/Link'
import { useQuery } from 'components/hooks/useQuery'
import { sendEvent, EventType } from 'components/lib/events'

type Props = {
results: SearchResultsT
query: string
}
export function SearchResults({ results }: Props) {
export function SearchResults({ results, query }: Props) {
const { t } = useTranslation('search')

const pages = Math.ceil(results.meta.found.value / results.meta.size)
Expand All @@ -31,20 +33,27 @@ export function SearchResults({ results }: Props) {
)}
</p>

<SearchResultHits hits={results.hits} />
<SearchResultHits hits={results.hits} query={query} />

{pages > 1 && <ResultsPagination page={page} totalPages={pages} />}
</div>
)
}

function SearchResultHits({ hits }: { hits: SearchResultHitT[] }) {
function SearchResultHits({ hits, query }: { hits: SearchResultHitT[]; query: string }) {
const { debug } = useQuery()
return (
<div>
{hits.length === 0 && <NoSearchResults />}
{hits.map((hit) => (
<SearchResultHit key={hit.id} hit={hit} debug={debug} />
{hits.map((hit, index) => (
<SearchResultHit
key={hit.id}
hit={hit}
query={query}
totalHits={hits.length}
index={index}
debug={debug}
/>
))}
</div>
)
Expand All @@ -61,7 +70,19 @@ function NoSearchResults() {
)
}

function SearchResultHit({ hit, debug }: { hit: SearchResultHitT; debug: boolean }) {
function SearchResultHit({
hit,
query,
totalHits,
index,
debug,
}: {
hit: SearchResultHitT
query: string
totalHits: number
index: number
debug: boolean
}) {
const title =
hit.highlights.title && hit.highlights.title.length > 0 ? hit.highlights.title[0] : hit.title

Expand All @@ -72,6 +93,16 @@ function SearchResultHit({ hit, debug }: { hit: SearchResultHitT; debug: boolean
href={hit.url}
className="color-fg-accent"
dangerouslySetInnerHTML={{ __html: title }}
onClick={() => {
sendEvent({
type: EventType.searchResult,
search_result_query: Array.isArray(query) ? query[0] : query,
search_result_index: index,
search_result_total: totalHits,
search_result_rank: (totalHits - index) / totalHits,
search_result_url: hit.url,
})
}}
></Link>
</h2>
<h3 className="text-normal f4 mb-2">{hit.breadcrumbs}</h3>
Expand Down
2 changes: 1 addition & 1 deletion components/search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function Search() {
{error ? (
<SearchError error={error} />
) : results ? (
<SearchResults results={results} />
<SearchResults results={results} query={query} />
) : hasQuery ? (
<Loading />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ After changing your username, links to your previous profile page, such as `http

{% ifversion fpt or ghec %}Git commits that were associated with your {% data variables.product.product_name %}-provided `noreply` email address won't be attributed to your new username and won't appear in your contributions graph.{% endif %} If your Git commits are associated with another email address you've [added to your GitHub account](/articles/adding-an-email-address-to-your-github-account), {% ifversion fpt or ghec %}including the ID-based {% data variables.product.product_name %}-provided `noreply` email address, {% endif %}they'll continue to be attributed to you and appear in your contributions graph after you've changed your username. For more information on setting your email address, see "[Setting your commit email address](/articles/setting-your-commit-email-address)."

## Your gists

After changing your username, the URLs to any public or secret gists will also change and previous links to these will return a 404 error. We recommend updating the links to these gists anywhere you may have shared them.

## Changing your username

{% data reusables.user-settings.access_settings %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ The following operating systems are supported for the self-hosted runner applica
The following processor architectures are supported for the self-hosted runner application.

- `x64` - Linux, macOS, Windows.
- `ARM64` - Linux{% ifversion actions-macos-arm %}, macOS{% endif %}.
- `ARM32` - Linux only.
- `ARM64` - Linux{% ifversion actions-macos-arm %}, macOS{% endif %}{% ifversion actions-windows-arm %}, Windows (currently in beta){% endif %}.
- `ARM32` - Linux.

{% ifversion ghes %}

Expand Down
6 changes: 6 additions & 0 deletions content/actions/learn-github-actions/contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ The following table indicates where each context and special function can be use

| Workflow key | Context | Special functions |
| ---- | ------- | ----------------- |
{%- ifversion actions-run-name %}
| <code>run-name</code> | <code>github, inputs</code> | |
{%- endif %}
| <code>concurrency</code> | <code>github, inputs</code> | |
| <code>env</code> | <code>github, secrets, inputs</code> | |
| <code>jobs.&lt;job_id&gt;.concurrency</code> | <code>github, needs, strategy, matrix, inputs</code> | |
Expand Down Expand Up @@ -211,6 +214,9 @@ The `github` context contains information about the workflow run and the event t
{%- ifversion fpt or ghec or ghes > 3.5 or ghae > 3.4 %}
| `github.run_attempt` | `string` | A unique number for each attempt of a particular workflow run in a repository. This number begins at 1 for the workflow run's first attempt, and increments with each re-run. |
{%- endif %}
{%- ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
| `github.secret_source` | `string` | The source of a secret used in a workflow. Possible values are `None`, `Actions`, `Dependabot`, or `Codespaces`. |
{%- endif %}
| `github.server_url` | `string` | The URL of the GitHub server. For example: `https://github.com`. |
| `github.sha` | `string` | {% data reusables.actions.github_sha_description %} |
| `github.token` | `string` | A token to authenticate on behalf of the GitHub App installed on your repository. This is functionally equivalent to the `GITHUB_TOKEN` secret. For more information, see "[Automatic token authentication](/actions/security-guides/automatic-token-authentication)." <br /> Note: This context property is set by the Actions runner, and is only available within the execution `steps` of a job. Otherwise, the value of this property will be `null`. |{% ifversion actions-stable-actor-ids %}
Expand Down
Loading

0 comments on commit 4ac5bae

Please sign in to comment.