load #3133
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: Atlas Parser | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
jobs: | |
atlas: | |
runs-on: ubuntu-latest | |
env: | |
output_dir: "data/" | |
cache_dir: "cache/" | |
mc_user: ${{ secrets.MC_USER }} | |
mc_pwd: ${{ secrets.MC_PWD }} | |
fandom_user: ${{ secrets.FANDOM_USER }} | |
fandom_pwd: ${{ secrets.FANDOM_PWD }} | |
discord_webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
steps: | |
- name: Get Date | |
id: get-date | |
run: | | |
/bin/date | |
echo "date=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT | |
curl -s https://ipinfo.io/ip | |
shell: bash | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: chaldea-center/fgo-game-data-api | |
path: fgo-game-data-api | |
- name: Configure git author | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Save payload | |
if: ${{ github.event.client_payload }} | |
run: | | |
echo '${{ toJson(github.event.client_payload) }}' >> payload.json | |
cat payload.json | |
- name: Cache Atlas and wiki api response | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.cache_dir }} | |
fail-on-cache-miss: true | |
save-always: true | |
key: api-cache-${{ runner.os }}-${{ steps.get-date.outputs.date }} | |
restore-keys: | | |
api-cache-${{ runner.os }}- | |
api-cache- | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
mv fgo-game-data-api/app app | |
rm -rf fgo-game-data-api | |
pip install -r requirements.txt | |
npm --location=global install js-beautify | |
- name: Checkout data repo | |
uses: actions/checkout@v4 | |
with: | |
repository: chaldea-center/chaldea-data | |
token: ${{ secrets.GH_PAGES_TOKEN }} | |
path: ${{ env.output_dir }} | |
fetch-depth: 3 | |
- name: Try parsing wiki | |
run: python main.py trywiki | |
- name: Commit wiki update | |
working-directory: ${{ env.output_dir }} | |
run: | | |
git add . | |
git --no-pager diff --stat --staged | |
git commit -m "update wiki data" || echo "Nothing to commit" | |
- name: Parse atlas | |
run: python main.py atlas | |
- name: Publish data | |
working-directory: ${{ env.output_dir }} | |
run: | | |
git add . | |
git --no-pager diff --stat --staged | |
if [ -e commit-msg.txt ] | |
then | |
git commit -F commit-msg.txt || echo "Nothing to commit" | |
else | |
git commit -m "atlas parser: update data" || echo "Nothing to commit" | |
fi | |
git push |