Skip to content

Commit 3131097

Browse files
authored
Create auto_merge.yml
1 parent 4afd2dc commit 3131097

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/auto_merge.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: auto_merge
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: 0 8 * * fri
7+
# cron表达式,每周五16点执行一次,actions任务时区为UTC时区。
8+
9+
10+
jobs:
11+
merge:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
ref: main
18+
fetch-depth: 0
19+
lfs: true
20+
21+
- name: Set git identity
22+
run : |
23+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
24+
git config --global user.name "github-actions[bot]"
25+
- name: Load upstream commits
26+
run: |
27+
git update-index --assume-unchanged ./src/main/resources/config.json
28+
git pull https://github.com/JunzhouLiu/BILIBILI-HELPER.git --log --no-commit
29+
- name: Apply commit changes
30+
run: |
31+
if [ -f ./.git/MERGE_MSG ]; then
32+
mkdir ./tmp && cp ./.git/MERGE_MSG ./tmp/message
33+
sed -i "1c [bot] AutoMerging: merge all upstream's changes:" ./tmp/message
34+
sed -i '/^\#.*/d' ./tmp/message
35+
git commit --file="./tmp/message"
36+
else
37+
echo "There is no merge commits."
38+
fi
39+
- name: Push Commits
40+
env:
41+
DOWNSTREAM_BRANCH: main
42+
TZ: Asia/Shanghai
43+
run: git push origin $DOWNSTREAM_BRANCH

0 commit comments

Comments
 (0)