-
Notifications
You must be signed in to change notification settings - Fork 25
109 lines (97 loc) · 3.04 KB
/
schemas.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: 📄 Schemas
on:
push:
branches: [main]
pull_request:
branches: ["**"]
permissions:
contents: write
pull-requests: write
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
rust: ${{ steps.filter.outputs.rust }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- '**/Cargo.*'
- '**/src/**'
- '**/tests/**'
- '**/build.rs'
- '**/migrations/**'
- '**/fixtures/**'
- '**/wit/**'
schemas:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.HOMESTAR_UPDATE_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
examples:
- 'examples/**'
rust:
- '**/Cargo.*'
- '**/src/**'
- '**/tests/**'
- '**/build.rs'
- '**/migrations/**'
- '**/fixtures/**'
- '**/wit/**'
deny:
- 'deny.toml'
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run generate schemas
run: cargo run -p homestar-schemas
# - name: Check for changed files
# id: changed-files
# uses: tj-actions/changed-files@v42
# with:
# # files: homestar-runtime/schemas/docs/**
# files: |
# **.json
# since_last_remote_commit: true
# - name: List all changed files
# env:
# ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
# run: |
# for file in ${ALL_CHANGED_FILES}; do
# echo "$file was changed"
# done
- name: Check for modified files
id: git-check
run: echo modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) >> $GITHUB_OUTPUT
- name: Show check modified value
env:
CHANGED: ${{ steps.git-check.outputs.modified }}
run: |
echo "$CHANGED"
- name: Push changes
# if: steps.changed-files.outputs.any_changed == 'true'
if: steps.git-check.outputs.modified == 'true'
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git commit -am "chore(schemas): update OpenRPC API doc and JSON schemas"
git push --force-with-lease origin HEAD:refs/heads/${{ github.head_ref }}