📝 Convert YAML to JSON #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |