Update fork tinymce-clean-server and push updated submodule to ZotPrime #116
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 tinymce-clean-server and push updated submodule to ZotPrime | |
on: | |
schedule: | |
- cron: '30 7 * * 1,4' | |
# scheduled at 07:30 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/tinymce-clean-server | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- name: Fetch upstream changes | |
id: sync | |
uses: ivanmilov/upstream_check_new_commits@v1 | |
with: | |
upstream_repository: zotero/tinymce-clean-server | |
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/tinymce-clean-server | |
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/tinymce-clean-server.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 stack/tinymce-clean-server/tinymce-clean-server | |
git add . | |
git commit -m 'Github Actions Update Submodule tinymce-clean-server' | |
git push origin development | |