Skip to content

Commit 9b5c361

Browse files
authored
Merge branch 'main' into patch-2
2 parents 1812cbf + e95f8d2 commit 9b5c361

187 files changed

Lines changed: 1881 additions & 1336 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs')
4+
const core = require('@actions/core')
5+
const eventPayload = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'))
6+
7+
// This workflow-run script does the following:
8+
// 1. Gets an array of labels on a PR.
9+
// 2. Finds one with the relevant Algolia text; if none found, exits early.
10+
// 3. Gets the version substring from the label string.
11+
12+
const labelText = 'sync-english-index-for-'
13+
const labelsArray = eventPayload.pull_request.labels
14+
15+
// Exit early if no labels are on this PR
16+
if (!(labelsArray && labelsArray.length)) {
17+
process.exit(0)
18+
}
19+
20+
// Find the relevant label
21+
const algoliaLabel = labelsArray
22+
.map(label => label.name)
23+
.find(label => label.startsWith(labelText))
24+
25+
// Exit early if no relevant label is found
26+
if (!algoliaLabel) {
27+
process.exit(0)
28+
}
29+
30+
// Given: sync-english-index-for-enterprise-server@3.0
31+
// Returns: enterprise-server@3.0
32+
const versionToSync = algoliaLabel.split(labelText)[1]
33+
34+
// Store the version so we can access it later in the workflow
35+
core.setOutput('versionToSync', versionToSync)
36+
process.exit(0)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Algolia Sync Single English Index
2+
3+
on:
4+
pull_request:
5+
types:
6+
- labeled
7+
- unlabeled
8+
- opened
9+
- reopened
10+
- synchronize
11+
- ready_for_review
12+
- unlocked
13+
14+
# This workflow requires a label in the format `sync-english-index-for-<PLAN@RELEASE>`
15+
jobs:
16+
updateIndices:
17+
name: Update English index for single version based on a label's version
18+
if: github.repository == 'github/docs-internal'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: checkout
22+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
23+
- uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d
24+
with:
25+
node-version: 14.x
26+
- name: cache node modules
27+
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
28+
with:
29+
path: ~/.npm
30+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
31+
restore-keys: |
32+
${{ runner.os }}-node-
33+
- name: npm ci
34+
run: npm ci
35+
- name: Get version from Algolia label if present; only continue if the label is found.
36+
id: getVersion
37+
run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js
38+
- if: ${{ steps.getVersion.outputs.versionToSync }}
39+
name: Sync English index for single version
40+
env:
41+
VERSION: ${{ steps.getVersion.outputs.versionToSync }}
42+
LANGUAGE: 'en'
43+
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
44+
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: npm run sync-search

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Examples of unacceptable behavior include:
2222
* Trolling, insulting or derogatory comments, and personal or political attacks
2323
* Public or private harassment
2424
* Publishing others' private information, such as a physical or email address, without their explicit permission
25+
* Contacting individual members, contributors, or leaders privately, outside designated community mechanisms, without their explicit permission
2526
* Other conduct which could reasonably be considered inappropriate in a professional setting
2627

2728
## Enforcement Responsibilities

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This repository contains the documentation website code and Markdown source file
55
GitHub's Docs team works on pre-production content in a private repo that regularly syncs with this public repo.
66

77
In this article:
8+
89
- [Contributing](#contributing)
910
- [READMEs](#readmes)
1011
- [License](#license)
@@ -34,6 +35,7 @@ If you have a solution to one of the open issues, you will need to fork the repo
3435
We use GitHub Discussions to talk about all sorts of topics related to documentation and this site. For example: if you'd like help troubleshooting a PR, have a great new idea, or want to share something amazing you've learned in our docs, join us in [discussions](https://github.com/github/docs/discussions).
3536

3637
#### And that's it!
38+
3739
That's how you can get started easily as a member of the GitHub Documentation community. :sparkles:
3840

3941
If you want to know more, or you're making a more complex contribution, check out [Getting Started with Contributing](/CONTRIBUTING.md).
38.1 KB
Loading
19 KB
Loading
16.6 KB
Loading
-18.9 KB
Loading
7.86 KB
Loading
95 KB
Loading

0 commit comments

Comments
 (0)