forked from anthonysidesap/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
121 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
ALGOLIA_API_KEY= | ||
ALGOLIA_APPLICATION_ID= | ||
ALLOW_TRANSLATION_COMMITS= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,95 @@ | ||
name: Sync search indexes | ||
|
||
# **What it does**: This updates our search indexes after each deployment. | ||
# **What it does**: This workflow syncs the Lunr search indexes. | ||
# The search indexes are checked into the lib/search/indexes directory. | ||
# Search indexes are checked directly into the `main` branch on both the | ||
# internal and open-source docs repositories. This workflow should be the | ||
# only mechanism that the search indexes are modified. Because of that, | ||
# repo-sync will not sync the search indexes because it should not detect | ||
# a change. | ||
# **Why we have it**: We want our search indexes kept up to date. | ||
# **Who does it impact**: Anyone using search on docs. | ||
|
||
# **Testing: To test this workflow, use the workflow_dispatch event and trigger | ||
# the workflow from the action tab. Select the branch with the changes to the | ||
# workflow. Set `fetch-depth: 0` as an input to the checkout action to get all | ||
# branches, including your test branch. Otherwise, you'll only get the main | ||
# branch. For git lfs push and git push commands use the --dry-run switch to | ||
# prevent pushes (e.g., git push --dry-run origin main --no-verify and | ||
# git lfs push --dry-run public-docs-repo). | ||
# The dry-run switch does everything but actually send the updates. | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '53 0/4 * * *' # Run every four hours at 53 minutes past the hour | ||
|
||
jobs: | ||
updateIndices: | ||
name: Update indices | ||
updateIndexes: | ||
name: Update indexes | ||
if: github.repository == 'github/docs-internal' | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Check out internal docs repository | ||
- name: checkout | ||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f | ||
with: | ||
token: ${{ secrets.DOCS_BOT }} | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f | ||
with: | ||
node-version: 16.x | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run build scripts | ||
run: npm run build | ||
- name: sync indices | ||
|
||
- name: Update search indexes | ||
env: | ||
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }} | ||
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npm run sync-search | ||
# TODO remove version and language after first successful run to test | ||
run: VERSION=github-ae@latest LANGUAGE=pt npm run sync-search | ||
|
||
- name: Update private docs repository search indexes | ||
# Git pre-push hooks push the LFS objects, so if you don't run them and | ||
# don't push the LFS objects manually, the LFS objects won't get | ||
# pushed. That will likely result in the push getting rejected. | ||
# So if you don't use the pre-push hooks or you run with --no-verify | ||
# the LFS objects need to be pushed first. | ||
run: | | ||
echo 'git checkout main' | ||
git checkout main | ||
echo 'git config user.name "GitHub Actions"' | ||
git config user.name "GitHub Actions" | ||
echo 'git config user.email [email protected]' | ||
git config user.email [email protected] | ||
echo 'git commit -am "update search indexes"' | ||
git commit -am "update search indexes" | ||
echo 'git lfs push origin' | ||
git lfs push origin | ||
echo 'git push origin main --no-verify' | ||
git push origin main --no-verify | ||
- name: Update open-source docs repository search indexes | ||
# Git pre-push hooks push the LFS objects, so if you don't run them and | ||
# don't push the LFS objects manually, the LFS objects won't get | ||
# pushed. That will likely result in the push getting rejected. | ||
# So if you don't use the pre-push hooks or you run with --no-verify | ||
# the LFS objects need to be pushed first. | ||
run: | | ||
echo 'git remote add public-docs-repo https://github.com/github/docs.git' | ||
git remote add public-docs-repo https://github.com/github/docs.git | ||
echo 'git lfs push public-docs-repo' | ||
git lfs push public-docs-repo | ||
echo 'git pull public-docs-repo main' | ||
git pull public-docs-repo main | ||
echo 'git push public-docs-repo main --no-verify' | ||
git push public-docs-repo main --no-verify | ||
- name: Send slack notification if workflow run fails | ||
uses: someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd | ||
if: failure() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.algolia-cache | ||
.search-cache | ||
.DS_Store | ||
.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.