-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (38 loc) · 1.43 KB
/
update-swagger.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
name: Update Swagger JSON
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
update-swagger:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download latest swagger.json
run: |
curl -o swagger_new.json https://raw.githubusercontent.com/lightdash/lightdash/main/packages/backend/src/generated/swagger.json
- name: Check for changes
id: check_changes
run: |
if [ ! -f swagger.json ]; then
echo "First time download - copying file"
cp swagger_new.json swagger.json
echo "has_changes=true" >> $GITHUB_OUTPUT
elif ! cmp -s swagger.json swagger_new.json; then
echo "Changes detected - updating file"
cp swagger_new.json swagger.json
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "No changes detected"
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
rm swagger_new.json
- name: Commit and push if changed
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add swagger.json
git commit -m "chore: update swagger.json from lightdash"
git push