mirror of
https://github.com/tiennm99/loldle.git
synced 2026-10-13 16:15:13 +00:00
47 lines
1.4 KiB
YAML
47 lines
1.4 KiB
YAML
name: Sync champions to downstream repos
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: [champions.json]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
# Fan out champions.json to downstream repos.
|
|
# Each row: <repo> <dest-path> [post-copy command].
|
|
# Add a new target by appending one line — no other edits required.
|
|
- name: Sync
|
|
env:
|
|
GH_PAT: ${{ secrets.LOLDLE_PAT }}
|
|
run: |
|
|
set -euo pipefail
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
sync_repo() {
|
|
local repo=$1 dest=$2 post=${3:-}
|
|
local dir=${repo##*/}
|
|
git clone --depth 1 \
|
|
"https://x-access-token:${GH_PAT}@github.com/${repo}.git" "$dir"
|
|
cp champions.json "$dir/$dest"
|
|
(
|
|
cd "$dir"
|
|
if [ -n "$post" ]; then eval "$post"; fi
|
|
git add -A
|
|
if git diff --cached --quiet; then
|
|
echo "$repo already up to date"
|
|
exit 0
|
|
fi
|
|
git commit -m "chore(data): sync champions from loldle-data@${GITHUB_SHA::7}"
|
|
git push
|
|
)
|
|
}
|
|
|
|
sync_repo tiennm99/loldle public/champions.json
|