Update fork zotero-build and push updated submodule to ZotPrime #106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update fork zotero-build and push updated submodule to ZotPrime | |
on: | |
schedule: | |
- cron: '40 7 * * 1,4' | |
# scheduled at 07:40 every Monday and Thursday | |
workflow_dispatch: # click the button on Github repo! | |
permissions: | |
contents: write | |
jobs: | |
upstream_commits: | |
runs-on: ubuntu-latest | |
name: Check upstream latest commits | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
with: | |
repository: uniuuu/zotero-build | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- name: Fetch upstream changes | |
id: sync | |
uses: ivanmilov/upstream_check_new_commits@v1 | |
with: | |
upstream_repository: zotero/zotero-build | |
upstream_branch: master | |
target_branch: master | |
outputs: | |
newcommit: ${{ steps.sync.outputs.has_new_commits }} | |
sync-fork: | |
needs: upstream_commits | |
if: needs.upstream_commits.outputs.newcommit == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: uniuuu/zotero-build | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- uses: fregante/setup-git-user@v2 | |
- name: rebase with upstream | |
id: rebase | |
run: | | |
git remote add upstream https://github.com/zotero/zotero-build.git | |
git fetch upstream | |
git checkout master | |
git rebase upstream/master | |
git push origin master | |
update-submodule: | |
needs: sync-fork | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: fregante/setup-git-user@v2 | |
- name: Checkout submodules | |
run: | | |
git submodule update --init --recursive --remote client/zotero-build | |
git add . | |
git commit -m 'Github Actions Update Submodule client/zotero-build' | |
git push origin development | |