The following error can happen at random especially for jobs in parallel (matrix). This could be related to race condition.
Run ad-m/github-push-action@master
with:
branch: refs/heads/optimize-strategy-ac
github_token: ***
directory: .
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch refs/heads/optimize-strategy-ac
To https://github.com/EA31337/EA31337-Lite-optimization-tests.git
! [remote rejected] HEAD -> optimize-strategy-ac (cannot lock ref 'refs/heads/optimize-strategy-ac': is at 98bf7e54a615d7e23cbcf8688d22c4099a1d2240 but expected 00da1b358846ae9a8ffa71b34eb1e330e3a37e3d)
error: failed to push some refs to 'https://github.com/EA31337/EA31337-Lite-optimization-tests.git'
Error: Invalid status code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
code: 1
}
Error: Invalid status code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
My config:
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
# Otherwise, you will failed to push refs to dest repo.
fetch-depth: 0
- run: docker-compose run $DCA ${{ matrix.test }}
- name: Commit files
run: |
git config --local core.autocrlf false
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git pull origin ${{ github.ref }} --autostash --rebase -Xours
git add --renormalize .
git status
git commit -am "${{ github.workflow }}"
- name: Git Diff
run: NO_PAGER=1 git --no-pager diff HEAD^
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
I don't want to force push (because obviously something changed upstream right after the pull), so maybe integrating pull feature as well right before push could be useful and do some customizable number of retries?
One workaround is to move push action outside of matrix jobs by uploading changed from from matrix job, then downloading artifacts (e.g. patches) and push the changes at the final stage.
The following error can happen at random especially for jobs in parallel (matrix). This could be related to race condition.
My config:
I don't want to force push (because obviously something changed upstream right after the pull), so maybe integrating pull feature as well right before push could be useful and do some customizable number of retries?
One workaround is to move push action outside of matrix jobs by uploading changed from from matrix job, then downloading artifacts (e.g. patches) and push the changes at the final stage.