Skip to content

Commit 9ab4afa

Browse files
authored
Merge branch 'main' into scripts_refactor
2 parents 481153e + 14b50bd commit 9ab4afa

File tree

162 files changed

+4577
-1105
lines changed

Some content is hidden

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

162 files changed

+4577
-1105
lines changed

.github/workflows/build-search.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Update Algolia Search
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
workflow_dispatch:
9+
10+
schedule:
11+
- cron: '0 4 * * *'
12+
13+
env:
14+
PYTHONUNBUFFERED: 1 # Force the stdout and stderr streams to be unbuffered
15+
16+
jobs:
17+
update-search:
18+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'update search') && github.event.pull_request.base.ref == 'main'
19+
#if: contains(github.event.pull_request.labels.*.name, 'update search') # Updated to trigger directly on PRs with the label
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v3
25+
26+
- name: Set up Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: '20'
30+
31+
- name: Run Prep from Master
32+
run: yarn copy-clickhouse-repo-docs
33+
34+
- name: Run Auto Generate Settings
35+
run: yarn auto-generate-settings
36+
37+
- name: Run Indexer
38+
run: yarn run-indexer
39+
env:
40+
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
41+
ALGOLIA_APP_ID: 5H9UG7CX5W
42+
43+
- name: Verify Completion
44+
run: echo "All steps completed successfully!"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# This GitHub Action is used for triggering updates of
2+
# the toc.json files present in any directory that
3+
# needs an automatically generated table of contents.
4+
5+
name: Generate Table of Contents files
6+
7+
env:
8+
# Force the stdout and stderr streams to be unbuffered
9+
PYTHONUNBUFFERED: 1
10+
11+
on:
12+
schedule:
13+
- cron: '0 0 * * *'
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
generate_toc_formats:
21+
runs-on: ubuntu-latest
22+
steps:
23+
# Step 1: Check out the repository
24+
- name: Check out repository
25+
uses: actions/checkout@v3
26+
27+
# Step 2 - Setup Python
28+
- name: Set up Python
29+
uses: actions/setup-python@v3
30+
with:
31+
python-version: '3.x'
32+
33+
# Step 3: Install Python dependencies
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install -r 'scripts/table-of-contents-generator/requirements.txt'
38+
39+
# Step 4 - Pull main repo docs, run script to generate TOCs:
40+
- name: Generate TOCs
41+
run: |
42+
yarn prep-from-master
43+
python -u ./scripts/table-of-contents-generator/toc_gen.py --dir="docs/en/interfaces/formats" --single-toc --out="table-of-contents-files" --ignore "_snippets"
44+
45+
# Step 5 - Fail the workflow if script returns exit code 1
46+
- name: Check exit code
47+
run: |
48+
if [[ "${{ steps.toc_gen.outcome }}" == "failure" ]]; then
49+
echo "Ran into trouble generating a table of contents. See the logs for details."
50+
exit 1
51+
fi
52+
53+
# Step 6 - Check if anything was actually updated
54+
- name: Check for Changes
55+
id: check_changes
56+
run: |
57+
git status -u
58+
if [[ -n "$(git diff --exit-code)" ]]; then
59+
echo "Changes detected."
60+
echo "has_changes=true" >> $GITHUB_OUTPUT
61+
else
62+
echo "No changes detected."
63+
echo "has_changes=false" >> $GITHUB_OUTPUT
64+
fi
65+
66+
# Step 7 - Commit and Push generated Table Of Contents files
67+
- uses: stefanzweifel/git-auto-commit-action@v5
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
commit_message: "Autogenerate table of contents files from GitHub action - $(date '+%Y-%m-%d %H:%M:%S')"
72+
file_pattern: 'table-of-contents-files/*'
73+
branch: generate_table_of_contents
74+
create_branch: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ docs/en/cloud/manage/api/services-api-reference.md
4949
.vscode
5050
.aspell.en.prepl
5151
*.md.bak
52+
53+
# Don't ignore generated table of contents files
54+
!toc.json

copyClickhouseRepoDocs.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ echo "[$SCRIPT_NAME] Copying completed"
3131

3232
echo "[$SCRIPT_NAME] Generate changelog"
3333
cp docs/en/_placeholders/changelog/_index.md docs/en/whats-new/changelog/index.md
34-
if grep -q '^# $(date +%Y) Changelog' ClickHouse/CHANGELOG.md; then
35-
sed '/^# $(date +%Y) Changelog/d' ClickHouse/CHANGELOG.md > temp.txt
36-
cat >> docs/en/whats-new/changelog/index.md
37-
rm temp.txt
34+
if grep -q "^# $(date +%Y) Changelog" ClickHouse/CHANGELOG.md; then
35+
echo "Generating $(date +%Y) Changelog..."
36+
sed "/^# $(date +%Y) Changelog/d" ClickHouse/CHANGELOG.md > temp.txt
37+
echo "Changelog copied to temp.txt"
38+
cat temp.txt >> docs/en/whats-new/changelog/index.md
39+
echo "Changelog written to docs/en/whats-new/changelog/index.md"
40+
rm -f temp.txt
3841
echo "$(date +%Y) Changelog was updated."
3942
else
4043
current_year="$(date +%Y)"

docs/en/_snippets/_add_remote_ip_access_list_detail.md

Lines changed: 2 additions & 2 deletions

docs/en/_snippets/_check_ip_access_list_detail.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/en/_snippets/_clickhouse_mysql_cloud_setup.mdx

Lines changed: 30 additions & 5 deletions

docs/en/_snippets/_cloud_backup.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/en/_snippets/_launch_sql_console.md

Lines changed: 5 additions & 1 deletion
Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)