forked from esirplayground/AutoBuild-OpenWrt
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (47 loc) · 1.4 KB
/
Sync Code.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
59
60
#
# This is free software, lisence use MIT.
#
# Copyright (C) 2020 KFERMercer <[email protected]>
#
# <https://github.com/KFERMercer/OpenWrt-CI>
#
name: Sync Code from eSir Autobuild Script
# Add a button to trigger the workflow - Kuroko
on:
repository_dispatch:
workflow_dispatch:
# push:
# branches:
# - master
# schedule:
# - cron: 0 19 * * *
jobs:
merge:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0
lfs: true
- name: Syncing Preparation
run : |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Start Syncing Autobuild Most Updated Changes
run: git pull https://github.com/esirplayground/AutoBuild-OpenWrt.git --log --no-commit
- name: Download All New Changes
run: |
if [ -f ./.git/MERGE_MSG ]; then
mkdir ./tmp && cp ./.git/MERGE_MSG ./tmp/message
sed -i "1c [bot] AutoMerging: merge all upstream's changes:" ./tmp/message
sed -i '/^\#.*/d' ./tmp/message
git commit --file="./tmp/message"
else
echo "There is no merge commits."
fi
- name: Update My Script
env:
DOWNSTREAM_BRANCH: master
run: git push origin $DOWNSTREAM_BRANCH