Files
ak-endfield-api-archive/.github/workflows/main.yml
2026-04-04 01:42:34 +09:00

81 lines
2.6 KiB
YAML

name: Auto API update check
permissions:
actions: write
checks: write
contents: write
on:
# Scheduled trigger is disabled by default (use cron-job)
# Uncommenting the following two lines will enable it
# schedule:
# - cron: '0 16 * * *'
workflow_dispatch:
repository_dispatch:
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Create config auth
env:
CONFIG_AUTH_YAML_CTX: ${{ secrets.CONFIG_AUTH_YAML }}
run: |
mkdir -p config
echo "$CONFIG_AUTH_YAML_CTX" > config/config_auth.yaml
- name: Run archive script
uses: nick-fields/retry@v3
with:
max_attempts: 5
timeout_minutes: 10
command: bun run src/main.ts archive
- name: Format output folder
run: bun x oxfmt output
- name: Git commit and push
id: commit_1
continue-on-error: true
uses: iarekylew00t/verified-bot-commit@v2
with:
message: "[Auto] API update"
files: |
output/akEndfield/**
output/raw/**
output/mirror_file_list.json
if-no-commit: info
- name: Git commit and push (Fallback)
if: steps.commit_1.outcome == 'failure'
run: |
git add output/akEndfield/** output/raw/** output/mirror_file_list.json
git commit -m "[Auto] API update" || echo "No changes to commit"
git push
- name: Run GitHub mirror upload
run: bun run src/main.ts ghMirrorUpload
continue-on-error: true
- name: Format output folder
run: bun x oxfmt output
- name: Git pull
run: git pull
- name: Git commit and push
id: commit_2
continue-on-error: true
uses: iarekylew00t/verified-bot-commit@v2
with:
message: "[Auto] API update"
files: |
output/mirror_file_list.json
output/mirror_file_list_pending.json
if-no-commit: info
- name: Git commit and push (Fallback)
if: steps.commit_2.outcome == 'failure'
run: |
git add output/mirror_file_list.json output/mirror_file_list_pending.json
git commit -m "[Auto] API update" || echo "No changes to commit"
git push