Skip to content

Commit 67a2455

Browse files
authored
Merge branch 'main' into patch-1
2 parents c728da9 + 1c06a50 commit 67a2455

File tree

21 files changed

+294
-85
lines changed

21 files changed

+294
-85
lines changed

.github/workflows/link-check-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
see_if_should_skip:
99
continue-on-error: true
10-
runs-on: self-hosted
10+
runs-on: ubuntu-latest
1111
# Map a step output to a job output
1212
outputs:
1313
should_skip: ${{ steps.skip_check.outputs.should_skip }}
@@ -20,7 +20,7 @@ jobs:
2020
paths: '[".github/workflows/link-check-test.yml", "assets/**", "content/**", "data/**", "includes/**", "javascripts/**", "jest-puppeteer.config.js", "jest.config.js", "layouts/**", "lib/**", "middleware/**", "package-lock.json", "package.json", "server.js", "translations/**", "webpack.config.js"]'
2121
build:
2222
needs: see_if_should_skip
23-
runs-on: self-hosted
23+
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
2424
steps:
2525
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
2626
# Even if if doesn't do anything

.github/workflows/test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ jobs:
3131

3232
test:
3333
needs: see_if_should_skip
34-
runs-on: ubuntu-latest
34+
# Run on self-hosted if the private repo or ubuntu-latest if the public repo
35+
# See pull # 17442 in the private repo for context
36+
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
3537
timeout-minutes: 60
3638
strategy:
3739
fail-fast: false
@@ -72,15 +74,15 @@ jobs:
7274
name: Install dependencies
7375
run: npm ci
7476

75-
- name: Clone early access
76-
if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' && github.repository == 'github/docs-internal' }}
77+
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' && github.repository == 'github/docs-internal' }}
78+
name: Clone early access
7779
run: npm run heroku-postbuild
7880
env:
7981
DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
8082
GIT_BRANCH: ${{ github.ref }}
8183

82-
- name: Run build script
83-
if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' && github.repository != 'github/docs-internal' }}
84+
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' && github.repository != 'github/docs-internal' }}
85+
name: Run build script
8486
run: npm run build
8587

8688
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}

content/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ These labels operate cumulatively, so a self-hosted runner’s labels must match
6464

6565
### Routing precedence for self-hosted runners
6666

67-
If you use both repository-level and organization-level runners, {% data variables.product.prodname_dotcom %} follows an order of precedence when routing jobs to self-hosted runners:
68-
69-
1. The job's `runs-on` labels are processed. {% data variables.product.prodname_dotcom %} then attempts to locate a runner that matches the label requirements:
70-
2. The job is sent to a repository-level runner that matches the job labels. If no repository-level runner is available (either busy, offline, or no matching labels):
71-
3. The job is sent to an organization-level runner that matches the job labels. If no organization-level runner is available, the job request fails with an error.
67+
When routing a job to a self-hosted runner, {% data variables.product.prodname_dotcom %} looks for a runner that matches the job's `runs-on` labels:
68+
69+
1. {% data variables.product.prodname_dotcom %} first searches for a runner at the repository level, then at the organization level{% if currentVersion ver_gt "[email protected]" %}, then at the enterprise level{% endif %}.
70+
2. The job is then sent to the first matching runner that is online and idle.
71+
- If all matching online runners are busy, the job will queue at the level with the highest number of matching online runners.
72+
- If all matching runners are offline, the job will queue at the level with the highest number of matching offline runners.
73+
- If there are no matching runners at any level, the job will fail.
74+
- If the job remains queued for more than 24 hours, the job will fail.

content/actions/reference/workflow-syntax-for-github-actions.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,18 @@ steps:
701701

702702
You can set the `shell` value to a template string using `command […options] {0} [..more_options]`. {% data variables.product.prodname_dotcom %} interprets the first whitespace-delimited word of the string as the command, and inserts the file name for the temporary script at `{0}`.
703703

704+
For example:
705+
706+
```yaml
707+
steps:
708+
- name: Display the environment variables and their values
709+
run: |
710+
print %ENV
711+
shell: perl {0}
712+
```
713+
714+
The command used, `perl` in this example, must be installed on the runner. For information about the software included on GitHub-hosted runners, see "[Specifications for GitHub-hosted runners](/actions/reference/specifications-for-github-hosted-runners#supported-software)."
715+
704716
#### Exit codes and error action preference
705717

706718
For built-in shell keywords, we provide the following defaults that are executed by {% data variables.product.prodname_dotcom %}-hosted runners. You should use these guidelines when running shell scripts.

content/github/site-policy/guidelines-for-legal-requests-of-user-data.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ c/o Corporation Service Company
215215
2710 Gateway Oaks Drive, Suite 150N
216216
Sacramento, CA 95833-3505
217217
```
218+
Under state and federal law, GitHub can seek reimbursement for costs associated with compliance with a valid legal demand, such as a subpoena, court order or search warrant. We only charge to recover some costs, and these reimbursements cover only a portion of the costs we actually incur to comply with legal orders.
219+
220+
While we do not charge in emergency situations or in other exigent circumstances, we seek reimbursement for all other legal requests in accordance with the following schedule, unless otherwise required by law:
221+
222+
- Initial search of up to 25 identifiers: Free
223+
- Production of subscriber information/data for up to 5 accounts: Free
224+
- Production of subscriber information/data for more than 5 accounts: $20 per account
225+
- Secondary searches: $10 per search
218226

219227
Please make your requests as specific and narrow as possible, including the following information:
220228

content/rest/reference/permissions-required-for-github-apps.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ _Teams_
842842

843843
- [`GET /repos/:owner/:repo/code-scanning/alerts`](/rest/reference/code-scanning#list-code-scanning-alerts-for-a-repository) (:read)
844844
- [`GET /repos/:owner/:repo/code-scanning/alerts/:alert_id`](/rest/reference/code-scanning#get-a-code-scanning-alert) (:read)
845+
- [`PATCH /repos/:owner/:repo/code-scanning/alerts/:alert_id`](/rest/reference/code-scanning#update-a-code-scanning-alert) (:write)
846+
- [`GET /repos/:owner/:repo/code-scanning/analyses`](/rest/reference/code-scanning#list-recent-code-scanning-analyses-for-a-repository) (:read)
847+
- [`POST /repos/:owner/:repo/code-scanning/sarifs`](/rest/reference/code-scanning#upload-a-sarif-file) (:write)
845848
{% endif %}
846849

847850
{% if currentVersion == "free-pro-team@latest" %}

data/ui.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,6 @@ product_sublanding:
160160
tutorial: Tutorial
161161
how_to: How-to guide
162162
reference: Reference
163+
learning_track_nav:
164+
prevGuide: Previous Guide
165+
nextGuide: Next Guide

includes/article.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ <h2 id="in-this-article" class="f5 mb-2"><a class="link-gray-dark" href="#in-thi
6565
</div>
6666
</div>
6767

68-
<div class="d-block border-top border-gray-light mt-4 markdown-body">
68+
<div class="d-block mt-4 markdown-body">
69+
{% if currentLearningTrack and currentLearningTrack.trackName %}
70+
{% include learning-track-nav %}
71+
{% endif %}
6972
{% include helpfulness %}
7073
{% unless page.hidden %}{% include contribution %}{% endunless %}
7174
</div>

includes/learning-track-nav.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<div class="py-3 px-4 rounded bg-white border-gradient--purple-pink d-flex flex-justify-between learning-track-nav">
2+
{% assign track = currentLearningTrack %}
3+
4+
<span class="d-flex flex-column">
5+
{% if track.prevGuide %}
6+
<span class="f6 text-gray">{% data ui.learning_track_nav.prevGuide %}</span>
7+
<a href="{{track.prevGuide.href}}?learn={{track.trackName}}" class="text-bold text-gray">{{track.prevGuide.title}}</a>
8+
{% endif %}
9+
</span>
10+
11+
<span class="d-flex flex-column flex-items-end">
12+
{% if track.nextGuide %}
13+
<span class="f6 text-gray">{% data ui.learning_track_nav.nextGuide %}</span>
14+
<a href="{{track.nextGuide.href}}?learn={{track.trackName}}" class="text-bold text-gray text-right">{{track.nextGuide.title}}</a>
15+
{% endif %}
16+
</span>
17+
18+
</div>

javascripts/search.js

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ let $searchResultsContainer
1414
let $searchOverlay
1515
let $searchInput
1616

17+
// This is our default placeholder, but it can be localized with a <meta> tag
1718
let placeholder = 'Search topics, products...'
1819
let version
1920
let language
2021

2122
export default function search () {
23+
// First, only initialize search if the elements are on the page
2224
$searchInputContainer = document.getElementById('search-input-container')
2325
$searchResultsContainer = document.getElementById('search-results-container')
24-
2526
if (!$searchInputContainer || !$searchResultsContainer) return
2627

28+
// This overlay exists so if you click off the search, it closes
2729
$searchOverlay = document.querySelector('.search-overlay-desktop')
2830

2931
// There's an index for every version/language combination
@@ -36,15 +38,25 @@ export default function search () {
3638
placeholder = $placeholderMeta.content
3739
}
3840

41+
// Write the search form into its container
3942
$searchInputContainer.append(tmplSearchInput())
4043
$searchInput = $searchInputContainer.querySelector('input')
4144

42-
searchWithYourKeyboard('#search-input-container input', '.ais-Hits-item')
43-
toggleSearchDisplay()
44-
45+
// Prevent 'enter' from refreshing the page
4546
$searchInputContainer.querySelector('form')
4647
.addEventListener('submit', evt => evt.preventDefault())
48+
49+
// Search when the user finished typing
4750
$searchInput.addEventListener('keyup', debounce(onSearch))
51+
52+
// Adds ability to navigate search results with keyboard (up, down, enter, esc)
53+
searchWithYourKeyboard('#search-input-container input', '.ais-Hits-item')
54+
55+
// If the user already has a query in the URL, parse it and search away
56+
parseExistingSearch()
57+
58+
// If not on home page, decide if search panel should be open
59+
toggleSearchDisplay() // must come after parseExistingSearch
4860
}
4961

5062
// The home page and 404 pages have a standalone search
@@ -64,43 +76,37 @@ function toggleSearchDisplay () {
6476
// If not on homepage...
6577
if (hasStandaloneSearch()) return
6678

67-
const $input = $searchInput
68-
69-
// Open modal if input is clicked
70-
$input.addEventListener('focus', () => {
71-
openSearch()
72-
})
79+
// Open panel if input is clicked
80+
$searchInput.addEventListener('focus', openSearch)
7381

74-
// Close modal if overlay is clicked
82+
// Close panel if overlay is clicked
7583
if ($searchOverlay) {
76-
$searchOverlay.addEventListener('click', () => {
77-
closeSearch()
78-
})
84+
$searchOverlay.addEventListener('click', closeSearch)
7985
}
8086

81-
// Open modal if page loads with query in the params/input
82-
if ($input.value) {
87+
// Open panel if page loads with query in the params/input
88+
if ($searchInput.value) {
8389
openSearch()
8490
}
8591
}
8692

93+
// On most pages, opens the search panel
8794
function openSearch () {
8895
$searchInput.classList.add('js-open')
8996
$searchResultsContainer.classList.add('js-open')
9097
$searchOverlay.classList.add('js-open')
9198
}
9299

100+
// Close panel if not on homepage
93101
function closeSearch () {
94-
// Close modal if not on homepage
95102
if (!hasStandaloneSearch()) {
96103
$searchInput.classList.remove('js-open')
97104
$searchResultsContainer.classList.remove('js-open')
98105
$searchOverlay.classList.remove('js-open')
99106
}
100107

101-
const $hits = $searchResultsContainer.querySelector('.ais-Hits')
102-
if ($hits) $hits.style.display = 'none'
103108
$searchInput.value = ''
109+
onSearch()
104110
}
105111

106112
function deriveLanguageCodeFromPath () {
@@ -122,6 +128,7 @@ function deriveVersionFromPath () {
122128
: versionObject.miscBaseName
123129
}
124130

131+
// Wait for the event to stop triggering for X milliseconds before responding
125132
function debounce (fn, delay = 300) {
126133
let timer
127134
return (...args) => {
@@ -130,34 +137,47 @@ function debounce (fn, delay = 300) {
130137
}
131138
}
132139

133-
async function onSearch (evt) {
134-
const query = evt.target.value
135-
136-
const url = new URL(location.origin)
137-
url.pathname = '/search'
138-
url.search = new URLSearchParams({ query, version, language }).toString()
140+
// When the user finishes typing, update the results
141+
async function onSearch () {
142+
const query = $searchInput.value
139143

140-
const response = await fetch(url, {
141-
method: 'GET',
142-
headers: {
143-
'Content-Type': 'application/json'
144-
}
145-
})
146-
const results = response.ok ? await response.json() : []
144+
// Update the URL with the search parameters in the query string
145+
const pushUrl = new URL(location)
146+
pushUrl.search = query ? new URLSearchParams({ query }) : ''
147+
history.pushState({}, '', pushUrl)
148+
149+
// If there's a query, call the endpoint
150+
// Otherwise, there's no results by default
151+
let results = []
152+
if (query.trim()) {
153+
const endpointUrl = new URL(location.origin)
154+
endpointUrl.pathname = '/search'
155+
endpointUrl.search = new URLSearchParams({ language, version, query })
156+
157+
const response = await fetch(endpointUrl, {
158+
method: 'GET',
159+
headers: {
160+
'Content-Type': 'application/json'
161+
}
162+
})
163+
results = response.ok ? await response.json() : []
164+
}
147165

166+
// Either way, update the display
148167
$searchResultsContainer.querySelectorAll('*').forEach(el => el.remove())
149168
$searchResultsContainer.append(
150169
tmplSearchResults(results)
151170
)
152-
153171
toggleStandaloneSearch()
154172

155173
// Analytics tracking
156-
sendEvent({
157-
type: 'search',
158-
search_query: query
159-
// search_context
160-
})
174+
if (query.trim()) {
175+
sendEvent({
176+
type: 'search',
177+
search_query: query
178+
// search_context
179+
})
180+
}
161181
}
162182

163183
// If on homepage, toggle results container if query is present
@@ -189,6 +209,14 @@ function toggleStandaloneSearch () {
189209
if (queryPresent && $results) $results.style.display = 'block'
190210
}
191211

212+
// If the user shows up with a query in the URL, go ahead and search for it
213+
function parseExistingSearch () {
214+
const params = new URLSearchParams(location.search)
215+
if (!params.has('query')) return
216+
$searchInput.value = params.get('query')
217+
onSearch()
218+
}
219+
192220
/** * Template functions ***/
193221

194222
function tmplSearchInput () {

0 commit comments

Comments
 (0)