|
| 1 | +name: Sync * to adamlui/ai-apps/perplexity-omnibox/* |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: ["**", "!.*", "!package*json", "!eslint.config*"] |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + if: (github.repository == 'adamlui/perplexity-omnibox') && (github.event.commits[0].committer.username != 'kudo-sync-bot') |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + |
| 15 | + - name: Checkout adamlui/perplexity-omnibox |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + token: ${{ secrets.REPO_SYNC_PAT }} |
| 19 | + repository: adamlui/perplexity-omnibox |
| 20 | + path: adamlui/perplexity-omnibox |
| 21 | + |
| 22 | + - name: Checkout adamlui/ai-apps |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + token: ${{ secrets.REPO_SYNC_PAT }} |
| 26 | + repository: adamlui/ai-apps |
| 27 | + path: adamlui/ai-apps |
| 28 | + |
| 29 | + - name: Sync * to adamlui/ai-apps/perplexity-omnibox/* |
| 30 | + run: | |
| 31 | + rsync -avhr --delete --exclude={'.*','eslint*','package*json'} \ |
| 32 | + ${{ github.workspace }}/adamlui/perplexity-omnibox/ \ |
| 33 | + ${{ github.workspace }}/adamlui/ai-apps/perplexity-omnibox/ |
| 34 | +
|
| 35 | + - name: Escape backticks in commit msg |
| 36 | + env: |
| 37 | + COMMIT_MSG: ${{ github.event.head_commit.message }} |
| 38 | + run: | |
| 39 | + echo "ESCAPED_MSG<<EOF" >> $GITHUB_ENV |
| 40 | + echo "$COMMIT_MSG" | sed 's/`/\`/g' >> $GITHUB_ENV |
| 41 | + echo "EOF" >> $GITHUB_ENV |
| 42 | + |
| 43 | + - name: Config committer |
| 44 | + run: | |
| 45 | + gpg --batch --import <(echo "${{ secrets.GPG_PRIVATE_KEY }}") |
| 46 | + git config --global user.name "kudo-sync-bot" |
| 47 | + git config --global user.email "[email protected]" |
| 48 | + git config --global user.signingkey "${{ secrets.GPG_PRIVATE_ID }}" |
| 49 | +
|
| 50 | + - name: Push changes to adamlui/perplexity-omnibox |
| 51 | + run: | |
| 52 | + cd ${{ github.workspace }}/adamlui/perplexity-omnibox |
| 53 | + git add . |
| 54 | + git commit -S -n -m "$ESCAPED_MSG ↞ [auto-sync from \`adamlui/perplexity-omnibox\`]" || true |
| 55 | + git push |
| 56 | +
|
| 57 | + - name: Push changes to adamlui/ai-apps |
| 58 | + run: | |
| 59 | + cd ${{ github.workspace }}/adamlui/ai-apps |
| 60 | + git add . |
| 61 | + git commit -S -n -m "$ESCAPED_MSG ↞ [auto-sync from \`adamlui/perplexity-omnibox\`]" || true |
| 62 | + git push |
0 commit comments