-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (61 loc) · 2.35 KB
/
generate.yml
File metadata and controls
69 lines (61 loc) · 2.35 KB
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
name: Generate THOR Object Reference
on:
workflow_dispatch:
inputs:
thor_binary:
description: 'URL to THOR Linux binary (requires license, optional)'
required: false
default: ''
permissions:
contents: write
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install pyyaml
- name: Generate object types JSON (via THOR binary if provided)
run: |
if [ -n "${{ github.event.inputs.thor_binary }}" ]; then
echo "Downloading THOR binary from provided URL..."
curl -L -o thor-linux-64 "${{ github.event.inputs.thor_binary }}"
chmod +x thor-linux-64
./thor-linux-64 --describe-object-type all > thor-object-types.json
THOR_VERSION=$(./thor-linux-64 --version 2>/dev/null | head -1 || echo "unknown")
echo "THOR_VERSION=${THOR_VERSION}" >> $GITHUB_ENV
else
echo "No THOR binary provided. Using existing thor-object-types.json from repo."
if [ ! -f thor-object-types.json ]; then
echo "Error: thor-object-types.json not found in repository."
echo "Please provide a THOR binary URL or commit the JSON file first."
exit 1
fi
echo "THOR_VERSION=existing" >> $GITHUB_ENV
fi
- name: Generate reference docs
run: |
python3 generate_reference_v3.py thor-object-types.json --output-dir docs --format both
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/
if [ -f thor-object-types.json.new ]; then
git add thor-object-types.json
fi
if git diff --cached --quiet; then
echo "No changes to commit"
else
if [ "${THOR_VERSION}" = "existing" ]; then
git commit -m "chore: regenerate object reference from existing schema"
else
git commit -m "chore: regenerate object reference for ${THOR_VERSION}"
fi
git push
fi