Skip to content
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

[remote rejected] test -> test (shallow update not allowed) #102

Closed
rimonhanna opened this issue Sep 30, 2020 · 6 comments
Closed

[remote rejected] test -> test (shallow update not allowed) #102

rimonhanna opened this issue Sep 30, 2020 · 6 comments

Comments

@rimonhanna
Copy link

rimonhanna commented Sep 30, 2020

Version of the Action
`v4.x.x

Describe the bug
Only once in a while from a workflow triggered by a cron job I get this error:

1 file changed, 1 insertion(+)
INPUT_TAGGING_MESSAGE: 
 No tagging message supplied. No tag will be added.
INPUT_PUSH_OPTIONS: --force

! [remote rejected] test -> test (shallow update not allowed)
error: failed to push some refs to 'https://github.com/Eyvit/EyvitSalesforce'
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4.5.1/index.js:17: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
}

To Reproduce
Steps to reproduce the behavior:

Expected behavior
Action should commit the files successfully

Screenshots
NA

Used Workflow

yaml

on:
    workflow_dispatch:
    schedule:
        - cron: '*/30 0-4/1 * * 1-5' # Every Week Day from 2-6AM every 60 minutes

jobs:
    create-scratch-orgs:
        name: Batch Create Scratch Orgs
        runs-on: ubuntu-latest
        steps:

           - name: 'Checkout source code'
              uses: actions/checkout@v2
              with:
                  ref: 'test'
                  token: ${{ secrets.ACTIONS_ACESS_TOKEN }}

           - name: 'Commit updated scratch-orgs.txt to repo'
              uses: stefanzweifel/git-auto-commit-action@v4.5.1
              with:
                  commit_message: 'Created a new scratch org'
                  file_pattern: scratch-orgs.txt
                  push_options: '--force'
@stefanzweifel
Copy link
Owner

An error like (shallow update not allowed) seems to me related to how the repository is checked out via actions/checkout.

In your example you checkout the test-branch. This seems fine.
Maybe you could give it a try with setting fetch-depth: 0, so that everything is cloned (docs).

           - name: 'Checkout source code'
              uses: actions/checkout@v2
              with:
                  ref: 'test'
+                 fetch-depth: 0
                  token: ${{ secrets.ACTIONS_ACESS_TOKEN }}

Using a custom token (secrets.ACTIONS_ACESS_TOKEN) shouldn't have an impact. As you said, this only happens from time to time – so most of the time it works.

@rimonhanna
Copy link
Author

Thanks for the quick feedback! I'll give it a try and let you know if it worked.

@rimonhanna
Copy link
Author

Didn't work, same error still happened this morning 😢

@stefanzweifel
Copy link
Owner

Hm. I really have no idea how to fix this as I still think this is related to the checkout process and not to git-auto-commit. (The Action relies upon a correctly checked out repo to do its work)

Do the logs for "Checkout source code" step have anything in them that seems to indicate that something failed? Does it mention "shallow" or "detached"?

As I assume this is a private repo, do you have anything setup differently in the repo settings that could impact how the repo could be cloned


Searching the internet I found the --unshallow option for git.
Maybe it would make sense to add an additional step after the checkout process to run that command.

git fetch --unshallow

Source: https://stackoverflow.com/a/36123631/3863449

@rimonhanna
Copy link
Author

I finally figured out the issue, it turns out that in rare cases the workflows were overlapping in time (one starting while one ending) I increased the gap between the cron jobs and the issue has since been resolved, thanks a lot for trying to help! :)

@stefanzweifel
Copy link
Owner

@rimonhanna That actually went through my head once too, but I thought that couldn't be possible on Action.
Happy you could resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants