|
| 1 | +name: Sync ai-personas/ to KudoAI/ai-personas/python/ |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: [ai-personas/**] |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + if: (github.repository == 'adamlui/python-utils') && !contains(github.event.head_commit.message, '[auto-sync') |
| 11 | + runs-on: ubuntu-24.04 |
| 12 | + permissions: |
| 13 | + contents: read |
| 14 | + env: |
| 15 | + TZ: PST8PDT |
| 16 | + |
| 17 | + steps: |
| 18 | + |
| 19 | + - name: Checkout adamlui/python-utils |
| 20 | + uses: actions/checkout@v6.0.2 |
| 21 | + with: |
| 22 | + token: ${{ secrets.REPO_SYNC_PAT }} |
| 23 | + path: adamlui/python-utils |
| 24 | + |
| 25 | + - name: Checkout KudoAI/ai-personas |
| 26 | + uses: actions/checkout@v6.0.2 |
| 27 | + with: |
| 28 | + token: ${{ secrets.REPO_SYNC_PAT }} |
| 29 | + repository: KudoAI/ai-personas |
| 30 | + path: KudoAI/ai-personas |
| 31 | + |
| 32 | + - name: Sync ai-personas/ to KudoAI/ai-personas/python/ |
| 33 | + run: | |
| 34 | + rsync -avh --delete \ |
| 35 | + ${{ github.workspace }}/adamlui/python-utils/ai-personas/ \ |
| 36 | + ${{ github.workspace }}/KudoAI/ai-personas/python/ |
| 37 | +
|
| 38 | + - name: Escape backticks in commit msg |
| 39 | + env: |
| 40 | + COMMIT_MSG: ${{ github.event.head_commit.message }} |
| 41 | + run: | |
| 42 | + DELIM="EOF_$(uuidgen)" |
| 43 | + echo "ESCAPED_MSG<<$DELIM" >> "$GITHUB_ENV" |
| 44 | + echo "$COMMIT_MSG" | sed 's/`/\`/g' >> "$GITHUB_ENV" |
| 45 | + echo "$DELIM" >> "$GITHUB_ENV" |
| 46 | +
|
| 47 | + - name: Config committer |
| 48 | + env: |
| 49 | + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} |
| 50 | + GPG_PRIVATE_ID: ${{ secrets.GPG_PRIVATE_ID }} |
| 51 | + run: | |
| 52 | + gpg --batch --import <(echo "$GPG_PRIVATE_KEY") |
| 53 | + git config --global commit.gpgsign true |
| 54 | + git config --global user.name "kudo-sync-bot" |
| 55 | + git config --global user.email "auto-sync@kudoai.com" |
| 56 | + git config --global user.signingkey "$GPG_PRIVATE_ID" |
| 57 | +
|
| 58 | + - name: Push changes to KudoAI/ai-personas |
| 59 | + run: | |
| 60 | + cd ${{ github.workspace }}/KudoAI/ai-personas |
| 61 | + git add . |
| 62 | + git commit -n -m \ |
| 63 | + "$ESCAPED_MSG ↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/ai-personas]" || true |
| 64 | + git pull --rebase |
| 65 | + git push |
0 commit comments