I want to update my repository submodules, push to their respective forks and then commit changes to my main repo and push it.
Here is my github action yml:
---
name: Auto Update Submodules
# yamllint disable-line rule:truthy
on:
push:
# schedule:
# # Run every Wednesday at 4 AM.
# - cron: "0 4 * * WED"
jobs:
auto-update:
runs-on: ubuntu-latest
steps:
# Create private key to access private repos.
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/checkout@v2
with:
ref: '15.0'
submodules: true
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
persist-credentials: true
- name: Update submodules from origin
run: |
git submodule update --recursive --remote --merge --init --rebase
- name: Update from upstream and commit
run: |
git config --global user.name 'bot'
git config --global user.email 'bot@users.noreply.github.com'
cd src/odoo
git checkout 15.0
git remote add upstream git@github.com:odoo/odoo.git
git fetch upstream 15.0
git rebase upstream/15.0
git push
cd ../enterprise
git checkout 15.0
git remote add upstream git@github.com:odoo/enterprise.git
git fetch upstream 15.0
git rebase upstream/15.0
git push
cd ../..
git add .
git commit -m "[SUB] odoo/enterprise" || echo "No changes to commit"
git push origin 15.0
This is what I get when action is triggered:
git submodule update --recursive --remote --merge --init --rebase
shell: /usr/bin/bash -e {0}
env:
SSH_AUTH_SOCK: /tmp/ssh-VxFJiDzXtsoG/agent.2130
SSH_AGENT_PID: 2131
Rebasing (1/1)
warning: Cannot merge binary files: stock_barcode/static/img/barcodes_demo.pdf (HEAD vs. 944ae3a4 ([I18N] Update translation terms from Transifex))
CONFLICT (add/add): Merge conflict in worksheet/i18n/sv.po
Auto-merging worksheet/i18n/sv.po
CONFLICT (add/add): Merge conflict in worksheet/i18n/de.po
Auto-merging worksheet/i18n/de.po
CONFLICT (add/add): Merge conflict in website_twitter_wall/i18n/zh_TW.po
Auto-merging website_twitter_wall/i18n/zh_TW.po
CONFLICT (add/add): Merge conflict in website_twitter_wall/i18n/vi.po
Auto-merging website_twitter_wall/i18n/vi.po
CONFLICT (add/add): Merge conflict in website_twitter_wall/i18n/th.po
Auto-merging website_twitter_wall/i18n/th.po
...
...
Error: Process completed with exit code 2.
If I only fetch changes from upstream and use that to commit on main repo, it does update it. But then further workflow breaks, because it can't find those commits (which are coming directly from upstream repos).
I tried to update my submodules from upstream locally (from my PC) and it works fine. No conflicts, no errors, with (don't even need to force push it, because I don't have any custom changes):
git fetch upstream 15.0
git rebase upstream/15.0
git push
src/odoo
and src/enterprise
are paths to submodules.
What am I doing wrong with github actions that it behaves differently?
Could it be that it gets only shallow copy and things break because of it?