Skip to content

Fix copy buttons in HTML guide - fixed JavaScript syntax error #3

Fix copy buttons in HTML guide - fixed JavaScript syntax error

Fix copy buttons in HTML guide - fixed JavaScript syntax error #3

name: Build Search Index
on:
push:
branches:
- main
- master
paths:
- '**/*-guide.html'
- 'build-search-index.js'
pull_request:
branches:
- main
- master
paths:
- '**/*-guide.html'
- 'build-search-index.js'
workflow_dispatch:
jobs:
build-index:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install jsdom
- name: Build search index
run: node build-search-index.js
- name: Check if search-index.js changed
id: check_changes
run: |
if git diff --quiet search-index.js; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push if changed
if: steps.check_changes.outputs.changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add search-index.js
git commit -m "🔍 Update search index automatically"
git push