相信吾愛很多小伙伴用過BILIBILI-HELPER,
有沒有用了幾天后,項目連續報錯?
原因: 項目代碼舊了,需要更新
更新方法:
1.fork倉庫后,將你的倉庫拉到本地,如果沒有源頭倉庫,則添加源頭倉庫
git remote add upstream https://github.com/JunzhouLiu/BILIBILI-HELPER.git
2.更新上游倉庫main分支的代碼(pull操作實際上是 fetch+merge)
git pull upstream main
3. 將從源頭倉庫更新后的代碼推送到你自己的github倉庫
git push origin main
這樣你就能快速的從我的倉庫拉取最新的代碼,並更新到你自己的倉庫里了。自定義配置的同學,要注意config.json 不要被我的文件覆蓋了。
如果你提交代碼太慢,可以考慮git掛代{過}{濾}理,git 加代{過}{濾}理的方法是
git config --global https.proxy https://代{過}{濾}理服務IP:端口
取消,則是
git config --global --unset https.proxy
以上介紹的是手動方式,當然會有自動方式(兩種):
更新和幫助
1.使用 Github Actions 自動同步源倉庫代碼
參閱Issue8 使用GitHub Actions任務自動同步源倉庫代碼
該方案來自 @happy888888 #6 ,由於本操作會覆蓋用戶自己的config.json配置文件,所以暫時沒有合並到main分支,所以請使用自定義功能的朋友請慎用。 在./github/workflows目錄下創建auto_merge.yml文件,內容如下 name: auto_merge on: workflow_dispatch: schedule: - cron: 0 8 * * fri # cron表達式,每周五16點執行一次,actions任務時區為UTC時區。 jobs: merge: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 with: ref: main fetch-depth: 0 lfs: true - name: Set git identity run : | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" - name: Load upstream commits run: | git update-index --assume-unchanged ./src/main/resources/config.json git pull https://github.com/JunzhouLiu/BILIBILI-HELPER.git --log --no-commit - name: Apply commit 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: Push Commits env: DOWNSTREAM_BRANCH: main TZ: Asia/Shanghai run: git push origin $DOWNSTREAM_BRANCH
2. 使用Pull APP[推薦]
參閱 Pull APP
a GitHub App that keeps your forks up-to-date with upstream via automated pull requests.