-
Notifications
You must be signed in to change notification settings - Fork 17
38 lines (30 loc) · 1 KB
/
yaml2json.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
name: 📝 Convert YAML to JSON
on:
push:
paths: ['QUERIES.yaml']
branches: [main]
workflow_dispatch:
workflow_run:
workflows: ["🌥 Sync queries from Public Templates"]
types:
- completed
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- run: pip3 install pyyaml --user
- name: Convert YAML to JSON
run: cat QUERIES.yaml | python3 .github/scripts/yaml2json.py > QUERIES.json
- name: Commit and push changes
run: |
[[ "$(git status -s | wc -l)" == 0 ]] && exit 0
git config --local user.email "[email protected]"
git config --local user.name "ghost"
COMMIT_MSG="build: "
[[ "${{ github.event_name }}" == "workflow_dispatch" ]] && COMMIT_MSG+="[force] "
COMMIT_MSG+="compile JSON [$(date "+%d/%m/%Y %T")] :robot:"
git commit -am "${COMMIT_MSG}"
git push origin "${GITHUB_REF_NAME}"