-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: pull before push #84
Comments
I just run code inside the runner directly now rather than calling this action: jobs:
my_job_name:
runs-on: ubuntu-latest
steps:
# Standard checkout step
- name: Checkout code
id: git_checkout
uses: actions/checkout@v2
....
# Commit files
... # I use https://github.com/EndBug/add-and-commit
# Push config files
- name: Push code
id: git_push
run: |
# Pull first
git pull --rebase origin "${GITHUB_REF}"
# Push after
git push origin "${GITHUB_REF}" You may find this latest update https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/ quite useful. Setting |
@alexiswl Could you provide pull request to README of |
@ad-m while the concurrency means that the jobs don't run simultaneously, they still run from the one original commit. Whilst concurrency will stop 'race conditions' of two actions pushing commits to the repo at the exact same time, it won't fix the issue because the second push will always fail because it hasn't merged the commit of the first push. |
Any ideas on this? We are seeing this error when lots of GitHub actions fire closely together and errors with:
Is there a way to perform a pull/rebase before? |
Hi @nodesocket, do you tried - name: Commit files
run: |
git pull
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Add changes" -a @nsheff I think the point sounds valid to include a flag to pull the repository beforehand. I'll check how to include the functionality and prepare a PR. |
@ZPascal the action definition just does a checkout, runs a custom bash script which takes 1-2 seconds and then calls push. Do you spot anything or a solution? Are you recommending to call pull right before push? jobs:
update-helm-image-tags:
name: Updated Helm image tags
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: updateimagetags.sh
run: helm/updateimagetags.sh ${{ join(github.event.client_payload.applications, ',') }} ${{ join(github.event.client_payload.environments, ',') }} ${{ github.event.client_payload.image_tag }}
- name: Push
uses: ad-m/github-push-action@master
with:
force: false |
Hi @nodesocket, I would recommend trying a pull beforehand. I've got one question: Your bash script does the rest (git config, git add, git commit)? |
@ZPascal correct, in my bash script I am doing the following: git config --local user.name "GitHub Actions"
git config --local user.email "engineering+$GITHUB_ACTOR@acme.org"
git add --all
git commit -am "[gh-action] image tag for $APPLICATIONS in $ENVIRONMENTS to $IMAGE_TAG" Should I just add |
Hi @nodesocket, yes. I think that should solve the issue. |
this package should totally have pull as an optional parameter. |
See also #79
This action works well for me, but occasionally I am running 2 of them at the same time and one will push changes in the middle of another one pulling the changes and then pushing.
It would be convenient if there was a
pull_first: true
option that would re-issue thegit pull
right before pushing to avoid a push conflict. Force is not the option as that will overwrite the other push changes (and ruin history).The text was updated successfully, but these errors were encountered: