Skip to content

Commit 15ed86b

Browse files
authored
Merge pull request #14 from servicetitan/add-auto-publish-schema-action
Add publish st-schemas gha
2 parents 133053b + 0bd8a24 commit 15ed86b

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Publish ST Schemas
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'st-schemas/**'
9+
10+
jobs:
11+
publish-schemas:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Configure Git
21+
run: |
22+
git config --global user.name 'github-actions[bot]'
23+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
24+
25+
- name: Create or switch to st-schemas branch
26+
run: |
27+
# Check if st-schemas branch exists
28+
if git show-ref --verify --quiet refs/heads/st-schemas; then
29+
git checkout st-schemas
30+
git reset --hard origin/main
31+
else
32+
git checkout -b st-schemas
33+
fi
34+
35+
- name: Prepare st-schemas branch
36+
run: |
37+
# Remove all files and directories except st-schemas
38+
find . -maxdepth 1 ! -name '.' ! -name '..' ! -name '.git' ! -name 'st-schemas' -exec rm -rf {} +
39+
40+
# Move contents of st-schemas to root
41+
mv st-schemas/* ./
42+
rmdir st-schemas
43+
44+
# Remove any remaining hidden files/directories except .git
45+
find . -maxdepth 1 -name '.*' ! -name '.git' -exec rm -rf {} + 2>/dev/null || true
46+
47+
- name: Commit and push changes
48+
run: |
49+
# Check if there are changes to commit
50+
if [[ -n $(git status --porcelain) ]]; then
51+
git add .
52+
git commit -m "Update ST schemas from main branch
53+
54+
This commit contains the latest schemas from the st-schemas directory.
55+
Auto-generated by GitHub Actions."
56+
git push origin st-schemas --force
57+
else
58+
echo "No changes to commit"
59+
fi

st-schemas/account/response.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "http://json-schema.org/draft-04/schema#",
33
"title": "account.response",
44
"type": "object",
5-
"description": "Response for activating a customer's vendor account",
5+
"description": "Response for activating a customer's vendor account (updated)",
66
"additionalProperties": false,
77
"properties": {
88
"errorCode": {

0 commit comments

Comments
 (0)