From b308a2c438fe4127535fbcc980329679de07af19 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Tue, 23 Apr 2024 17:33:52 +0800 Subject: [PATCH] Initial commit. --- .github/workflows/update_enka_db.yml | 44 ++++++++++++++++++++++++++++ Makefile | 11 +++++++ README.md | 3 ++ 3 files changed, 58 insertions(+) create mode 100644 .github/workflows/update_enka_db.yml create mode 100644 Makefile create mode 100644 README.md diff --git a/.github/workflows/update_enka_db.yml b/.github/workflows/update_enka_db.yml new file mode 100644 index 0000000..d9d8a3a --- /dev/null +++ b/.github/workflows/update_enka_db.yml @@ -0,0 +1,44 @@ +name: Update EnkaDB Assets + +on: + workflow_dispatch: {} + schedule: + - cron: '0 12 * * *' + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Fetch latest commit SHA + id: latest_sha + run: echo "::set-output name=sha::$(git ls-remote https://github.com/EnkaNetwork/API-docs.git HEAD | cut -f1)" + + - name: Install QuickType + id: install_quicktype + run: npm install -g quicktype + + - name: Run update asset meta script + id: compare_shas + run: make + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: update-enka-asset-${{ github.run_number }} + base: main + title: "Update EnkaDB Assets" + body: | + This PR updates the EnkaDB Asset JSON files. + delete-branch: true + assignees: CanglongCl + reviewers: CanglongCl + team-reviewers: | + owners + maintainers \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8fd500a --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +SHELL := /bin/sh +.PHONY: build + +build: + rm -rf /var/tmp/temporaryJSON4Enka/ || true + mkdir /var/tmp/temporaryJSON4Enka/ + git clone https://github.com/EnkaNetwork/API-docs.git /var/tmp/temporaryJSON4Enka/ + cp -r /var/tmp/temporaryJSON4Enka/store ./ + rm -rf /var/tmp/temporaryJSON4Enka/ + export PATH=${PATH}:$(pwd) && CWD=$(pwd) && find . -name '*.json' -exec quicktype --lang swift {} --out {}.swift \; + find . -name '*.json' -exec rm {} \; diff --git a/README.md b/README.md new file mode 100644 index 0000000..9d32e55 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# EnkaDBStructMonitor + +This repo is for tracking Swift Struct changes from Enka-API-Docs repository.