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