You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
legado/.github/workflows/autoupdatefork.yml

46 lines
1.4 KiB

#更新fork
name: update fork
on:
release:
types: [published]
push:
tags:
- 'v*'
schedule:
- cron: '50 3 * * *' #设置定时任务
watch:
types: [started]
#修改[用户名],设置token并命名为GITHUB_TOKEN,具体方法百度
4 years ago
#设置secrets,并命名为EMAIL,内容为邮箱地址,设置方法百度,不介意邮箱泄露,可以直接将${{ secrets.EMAIL }}替换为邮箱
jobs:
build:
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install git
run: |
sudo apt-get update
sudo apt-get -y install git
4 years ago
- name: Set env
run: |
git config --global user.email "${{ secrets.EMAIL }}"
git config --global user.name "[用户名]"
- name: Download Repository
run: |
git clone https://github.com/[用户名]/legado.git /opt/legado
- name: Update fork
run: |
cd /opt/legado
git remote -v
git remote rm origin
git remote add origin https://[用户名]:${{ secrets.GITHUB_TOKEN }}@github.com/[用户名]/legado.git
git remote add upstream https://github.com/gedoor/legado.git
git remote -v
git fetch upstream
git checkout master
git merge upstream/master
git push origin master