Skip to content

Commit 01c43ab

Browse files
authored
Merge pull request github#8827 from github/repo-sync
repo sync
2 parents 1cb55fb + 74f54ce commit 01c43ab

File tree

46 files changed

+170
-520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+170
-520
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
ALGOLIA_API_KEY=
2-
ALGOLIA_APPLICATION_ID=
31
ALLOW_TRANSLATION_COMMITS=

.github/workflows/browser-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ jobs:
1919
# Even if if doesn't do anything
2020
- name: Checkout
2121
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
22+
with:
23+
lfs: true
24+
- name: Checkout LFS objects
25+
run: git lfs checkout
2226

2327
- name: Setup Node
2428
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f

.github/workflows/dry-run-sync-search-indices.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,5 @@ jobs:
2626
run: npm run build
2727
- name: (Dry run) sync indices
2828
env:
29-
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
30-
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
3129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3230
run: npm run sync-search-dry-run

.github/workflows/openapi-schema-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
branches:
1111
- main
1212
pull_request:
13+
paths:
14+
- 'lib/rest/static/**'
1315

1416
jobs:
1517
check-schema-versions:

.github/workflows/sync-search-indices.yml

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,95 @@
11
name: Sync search indexes
22

3-
# **What it does**: This updates our search indexes after each deployment.
3+
# **What it does**: This workflow syncs the Lunr search indexes.
4+
# The search indexes are checked into the lib/search/indexes directory.
5+
# Search indexes are checked directly into the `main` branch on both the
6+
# internal and open-source docs repositories. This workflow should be the
7+
# only mechanism that the search indexes are modified. Because of that,
8+
# repo-sync will not sync the search indexes because it should not detect
9+
# a change.
410
# **Why we have it**: We want our search indexes kept up to date.
511
# **Who does it impact**: Anyone using search on docs.
612

13+
# **Testing: To test this workflow, use the workflow_dispatch event and trigger
14+
# the workflow from the action tab. Select the branch with the changes to the
15+
# workflow. Set `fetch-depth: 0` as an input to the checkout action to get all
16+
# branches, including your test branch. Otherwise, you'll only get the main
17+
# branch. For git lfs push and git push commands use the --dry-run switch to
18+
# prevent pushes (e.g., git push --dry-run origin main --no-verify and
19+
# git lfs push --dry-run public-docs-repo).
20+
# The dry-run switch does everything but actually send the updates.
21+
722
on:
823
workflow_dispatch:
9-
push:
10-
branches:
11-
- main
24+
schedule:
25+
- cron: '53 0/4 * * *' # Run every four hours at 53 minutes past the hour
1226

1327
jobs:
14-
updateIndices:
15-
name: Update indices
28+
updateIndexes:
29+
name: Update indexes
1630
if: github.repository == 'github/docs-internal'
1731
runs-on: ubuntu-latest
1832
steps:
33+
# Check out internal docs repository
1934
- name: checkout
2035
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
36+
with:
37+
token: ${{ secrets.DOCS_BOT }}
38+
2139
- name: Setup Node
2240
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f
2341
with:
2442
node-version: 16.x
2543
cache: npm
44+
2645
- name: Install dependencies
2746
run: npm ci
47+
2848
- name: Run build scripts
2949
run: npm run build
30-
- name: sync indices
50+
51+
- name: Update search indexes
3152
env:
32-
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
33-
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
3453
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
run: npm run sync-search
54+
# TODO remove version and language after first successful run to test
55+
run: VERSION=github-ae@latest LANGUAGE=pt npm run sync-search
56+
57+
- name: Update private docs repository search indexes
58+
# Git pre-push hooks push the LFS objects, so if you don't run them and
59+
# don't push the LFS objects manually, the LFS objects won't get
60+
# pushed. That will likely result in the push getting rejected.
61+
# So if you don't use the pre-push hooks or you run with --no-verify
62+
# the LFS objects need to be pushed first.
63+
run: |
64+
echo 'git checkout main'
65+
git checkout main
66+
echo 'git config user.name "GitHub Actions"'
67+
git config user.name "GitHub Actions"
68+
echo 'git config user.email action@github.com'
69+
git config user.email action@github.com
70+
echo 'git commit -am "update search indexes"'
71+
git commit -am "update search indexes"
72+
echo 'git lfs push origin'
73+
git lfs push origin
74+
echo 'git push origin main --no-verify'
75+
git push origin main --no-verify
76+
77+
- name: Update open-source docs repository search indexes
78+
# Git pre-push hooks push the LFS objects, so if you don't run them and
79+
# don't push the LFS objects manually, the LFS objects won't get
80+
# pushed. That will likely result in the push getting rejected.
81+
# So if you don't use the pre-push hooks or you run with --no-verify
82+
# the LFS objects need to be pushed first.
83+
run: |
84+
echo 'git remote add public-docs-repo https://github.com/github/docs.git'
85+
git remote add public-docs-repo https://github.com/github/docs.git
86+
echo 'git lfs push public-docs-repo'
87+
git lfs push public-docs-repo
88+
echo 'git pull public-docs-repo main'
89+
git pull public-docs-repo main
90+
echo 'git push public-docs-repo main --no-verify'
91+
git push public-docs-repo main --no-verify
92+
3693
- name: Send slack notification if workflow run fails
3794
uses: someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd
3895
if: failure()

.github/workflows/sync-single-english-index.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ name: Sync Single English Index
55
# **Who does it impact**:
66

77
on:
8+
workflow_dispatch:
89
pull_request:
910
types:
1011
- labeled
@@ -39,9 +40,15 @@ jobs:
3940
env:
4041
VERSION: ${{ steps.getVersion.outputs.versionToSync }}
4142
LANGUAGE: 'en'
42-
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
43-
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
4443
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4544
run: |
4645
npm run build
4746
npm run sync-search
47+
- name: Check in search index
48+
uses: EndBug/add-and-commit@2bdc0a61a03738a1d1bda24d566ad0dbe3083d87
49+
with:
50+
# The arguments for the `git add` command
51+
add: 'lib/search/indexes'
52+
53+
# The message for the commit
54+
message: 'Updated search index for ${{ steps.getVersion.outputs.versionToSync }}'

.github/workflows/triage-unallowed-contributions.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- 'lib/redirects/**'
1717
- 'lib/rest/**'
1818
- 'lib/webhooks/**'
19+
- 'lib/search/indexes/**'
1920
- 'scripts/**'
2021
- 'translations/**'
2122
- 'package*.json'
@@ -76,6 +77,7 @@ jobs:
7677
- 'lib/redirects/**'
7778
- 'lib/rest/**'
7879
- 'lib/webhooks/**'
80+
- 'lib/search/indexes/**'
7981
- 'scripts/**'
8082
- 'translations/**'
8183
- 'package*.json'
@@ -101,6 +103,7 @@ jobs:
101103
'lib/redirects/**',
102104
'lib/rest/**',
103105
'lib/webhooks/**',
106+
'lib/search/indexes/**'
104107
'scripts/**',
105108
'translations/**',
106109
'package*.json',

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.algolia-cache
21
.search-cache
32
.DS_Store
43
.env
Loading
Loading

0 commit comments

Comments
 (0)