-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (60 loc) · 2.04 KB
/
build_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build index
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'catalog/**.yaml'
- 'catalog/**.yml'
permissions:
contents: write
jobs:
build-index:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
fetch-depth: 2
ref: 'main'
path: main
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
fetch-depth: 2
ref: 'gh-pages'
path: gh-pages
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install yaml & jsonschema
run: pip install pyyaml jsonschema
- name: Build index
run: python -B main/.github/scripts/build_index.py --build-branch main --deploy-branch gh-pages --folders-to-scan datasets
- name: Get last commit message - main
id: last-commit-message-main
run: echo "msg=$(git -C main log -1 --pretty=%s)" >> $GITHUB_OUTPUT
- name: Get last commit message - gh-pages
id: last-commit-message-gh-pages
run: echo "msg=$(git -C gh-pages log -1 --pretty=%s)" >> $GITHUB_OUTPUT
- name: Commit - main
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: ${{ steps.last-commit-message-main.outputs.msg }}
commit_options: '--amend --no-edit'
file_pattern: '*.json catalog/**.yaml'
push_options: '--force'
skip_fetch: true
repository: main
- name: Commit - gh-pages
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: ${{ steps.last-commit-message-gh-pages.outputs.msg }}
commit_options: '--amend --no-edit'
file_pattern: '*.json'
push_options: '--force'
skip_fetch: true
repository: gh-pages