-
Notifications
You must be signed in to change notification settings - Fork 81
54 lines (44 loc) · 1.34 KB
/
update-search-index.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Update Search Index
on:
push:
branches:
- master
jobs:
update-index:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Dependencies
run: yarn install
- name: Generate Search Index
run: yarn gen-search-index
- name: Set up Git Config
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Skip Duplicate Actions
id: skip_check
uses: fkirc/[email protected]
with:
cancel_others: 'true'
concurrent_skipping: 'outdated_runs'
- name: Extract Branch Name
id: extract_branch
shell: bash
run: |
echo "::set-output name=branch::${{ github.head_ref }}"
- name: Commit and Push Search Index Updates
if: steps.skip_check.outputs.should_skip != 'true' # Only run if not skipped
run: |
git add -A
git commit -m "Update search index" || echo "No changes to commit"
git push origin ${{ steps.extract_branch.outputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}