Update fork zotero-client and push updated submodule to ZotPrime #123
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-client and push updated submodule to ZotPrime | |
on: | |
schedule: | |
- cron: '50 7 * * 1,4' | |
# scheduled at 07:50 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 | |
uses: actions/checkout@v4 | |
with: | |
# ref: origin/6.0 | |
repository: uniuuu/zotero | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- name: Fetch upstream changes | |
id: sync | |
# run: | | |
# git config pull.rebase true | |
# git remote add upstream https://github.com/zotero/zotero | |
# git fetch --all | |
# git pull upstream 6.0 | |
# git push origin 6.0 | |
uses: ivanmilov/upstream_check_new_commits@v1 | |
with: | |
upstream_repository: zotero/zotero | |
upstream_branch: main | |
target_branch: main | |
# uses: aormsby/[email protected] | |
# with: | |
# target_sync_branch: 6.0 | |
# target_repo_token: ${{ secrets.API_TOKEN_GITHUB }} | |
# upstream_sync_branch: 6.0 | |
# upstream_sync_repo: zotero/zotero | |
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 | |
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.git | |
git fetch upstream | |
git checkout main | |
git rebase upstream/main | |
git push origin main | |
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 --remote client/zotero-client | |
git add -A | |
git diff-index --quiet HEAD || git commit -m 'Github Actions Update Submodule client/zotero-client' | |
git push origin development | |