Skip to content

Tagged gamer personas ↞ [auto-sync from https://github.com/KudoAI/ai-… #6

Tagged gamer personas ↞ [auto-sync from https://github.com/KudoAI/ai-…

Tagged gamer personas ↞ [auto-sync from https://github.com/KudoAI/ai-… #6

name: Sync ai-personas/**/ai-personas.json → KudoAI/ai-personas + adamlui/js-utils/ai-personas
on:
push:
branches: [main]
paths: ["ai-personas/**/ai-personas.json"]
jobs:
build:
if: (github.repository == 'adamlui/python-utils') && !contains(github.event.head_commit.message, '[auto-sync')
runs-on: ubuntu-24.04
permissions:
contents: read
env:
TZ: PST8PDT
steps:
- name: Checkout adamlui/python-utils
uses: actions/checkout@v6.0.2
with:
token: ${{ secrets.REPO_SYNC_PAT }}
path: adamlui/python-utils
- name: Checkout KudoAI/ai-personas
uses: actions/checkout@v6.0.2
with:
token: ${{ secrets.REPO_SYNC_PAT }}
repository: KudoAI/ai-personas
path: KudoAI/ai-personas
- name: Checkout adamlui/js-utils
uses: actions/checkout@v6.0.2
with:
token: ${{ secrets.REPO_SYNC_PAT }}
repository: adamlui/js-utils
path: adamlui/js-utils
- name: Get source ai-personas.json
run: |
cd ${{ github.workspace }}/adamlui/python-utils
src_file=$(find ai-personas -name "ai-personas.json" -type f | head -n 1)
if [[ -z "$src_file" ]] ; then echo "No source file found" ; exit 1 ; fi
echo "SRC_FILE=$src_file" >> $GITHUB_ENV
- name: Sync ai-personas.json → KudoAI/ai-personas
run: |
cd ${{ github.workspace }}/KudoAI/ai-personas
for file in $(find . -name "ai-personas.json") ; do
cp -f "${{ github.workspace }}/adamlui/python-utils/$SRC_FILE" "$file" ; done
- name: Sync ai-personas.json → adamlui/js-utils/ai-personas
run: |
cd ${{ github.workspace }}/adamlui/js-utils/ai-personas
for file in $(find . -name "ai-personas.json") ; do
cp -f "${{ github.workspace }}/adamlui/python-utils/$SRC_FILE" "$file" ; done
- name: Escape backticks in commit msg
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
DELIM="EOF_$(uuidgen)"
echo "ESCAPED_MSG<<$DELIM" >> "$GITHUB_ENV"
echo "$COMMIT_MSG" | sed 's/`/\`/g' >> "$GITHUB_ENV"
echo "$DELIM" >> "$GITHUB_ENV"
- name: Config committer
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_ID: ${{ secrets.GPG_PRIVATE_ID }}
run: |
gpg --batch --import <(echo "$GPG_PRIVATE_KEY")
git config --global commit.gpgsign true
git config --global user.name "kudo-sync-bot"
git config --global user.email "auto-sync@kudoai.com"
git config --global user.signingkey "$GPG_PRIVATE_ID"
- name: Push changes to KudoAI/ai-personas
run: |
cd ${{ github.workspace }}/KudoAI/ai-personas
git add . && git commit -n -m \
"$ESCAPED_MSG ↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/ai-personas]" || true
git pull --rebase
git push
- name: Push changes to adamlui/js-utils
run: |
cd ${{ github.workspace }}/adamlui/js-utils
git add . && git commit -n -m \
"$ESCAPED_MSG ↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/ai-personas]" || true
git pull --rebase
git push