|
| 1 | +name: Sync utils/bump/resources.js to adamlui/ai-web-extensions |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + paths: [utils/bump/resources.js] |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + sync-resources: |
| 13 | + if: (github.repository == 'adamlui/userscripts') && (github.event.commits[0].committer.username != 'kudo-sync-bot') |
| 14 | + runs-on: ubuntu-latest |
| 15 | + env: |
| 16 | + TZ: PST8PDT |
| 17 | + |
| 18 | + steps: |
| 19 | + |
| 20 | + - name: Checkout adamlui/userscripts |
| 21 | + uses: actions/checkout@v5 |
| 22 | + with: |
| 23 | + token: ${{ secrets.REPO_SYNC_PAT }} |
| 24 | + repository: adamlui/userscripts |
| 25 | + path: adamlui/userscripts |
| 26 | + |
| 27 | + - name: Checkout adamlui/ai-web-extensions |
| 28 | + uses: actions/checkout@v5 |
| 29 | + with: |
| 30 | + token: ${{ secrets.REPO_SYNC_PAT }} |
| 31 | + repository: adamlui/ai-web-extensions |
| 32 | + path: adamlui/ai-web-extensions |
| 33 | + |
| 34 | + - name: Sync resources.js |
| 35 | + run: | |
| 36 | + cp -f ${{ github.workspace }}/adamlui/userscripts/utils/bump/resources.js \ |
| 37 | + ${{ github.workspace }}/adamlui/ai-web-extensions/utils/bump/resources.js |
| 38 | +
|
| 39 | + - name: Escape backticks in commit msg |
| 40 | + env: |
| 41 | + COMMIT_MSG: ${{ github.event.head_commit.message }} |
| 42 | + run: | |
| 43 | + echo "ESCAPED_MSG<<EOF" >> $GITHUB_ENV |
| 44 | + echo "$COMMIT_MSG" | sed 's/`/\`/g' >> $GITHUB_ENV |
| 45 | + echo "EOF" >> $GITHUB_ENV |
| 46 | +
|
| 47 | + - name: Config committer |
| 48 | + run: | |
| 49 | + gpg --batch --import <(echo "${{ secrets.GPG_PRIVATE_KEY }}") |
| 50 | + git config --global commit.gpgsign true |
| 51 | + git config --global user.name "kudo-sync-bot" |
| 52 | + git config --global user.email "auto-sync@kudoai.com" |
| 53 | + git config --global user.signingkey "${{ secrets.GPG_PRIVATE_ID }}" |
| 54 | +
|
| 55 | + - name: Push changes to adamlui/ai-web-extensions |
| 56 | + run: | |
| 57 | + cd ${{ github.workspace }}/adamlui/ai-web-extensions |
| 58 | + git pull # sync w/ concurrent updates |
| 59 | + git add utils/bump/resources.js |
| 60 | + git commit -n -m "$ESCAPED_MSG ↞ [auto-sync from https://github.com/adamlui/userscripts/blob/master/utils/bump/resources.js]" || true |
| 61 | + git push |
0 commit comments