forked from luoyanglang/dujiao-next-user
-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (35 loc) · 1.04 KB
/
Copy pathsync-upstream.yml
File metadata and controls
40 lines (35 loc) · 1.04 KB
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
name: Sync upstream
on:
schedule:
- cron: "17 3 * * *"
workflow_dispatch:
permissions:
contents: write
actions: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: merge
name: Merge upstream main
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote add upstream https://github.com/dujiao-next/user.git
git fetch upstream main
if git merge-base --is-ancestor upstream/main HEAD; then
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git merge --no-edit upstream/main
git push origin HEAD:main
echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Rebuild custom image
if: steps.merge.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run docker.yml --ref main