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

Prevent creating an already existing branch. #97

merged 1 commit into from
Apr 20, 2021


Copy link

@jackton1 jackton1 commented Apr 20, 2021

Resolves error pushing to the current branch for private repositories

Screen Shot 2021-04-20 at 7 00 51 PM

    -b <branch>           create and checkout a new branch
    -B <branch>           create/reset and checkout a branch

@jackton1 jackton1 changed the title Prevent checking out an already existing branch. Prevent creating an already existing branch. Apr 20, 2021
Copy link

can you share an example workflow? from my testing this shouldn't be necessary and/or can overwrite other work

Copy link
Contributor Author

jackton1 commented Apr 20, 2021

Yeah had the same thought unable to get more information from the logs

2021-04-20T22:47:51.0456035Z Flake8.....................................................................�[42mPassed�[m
2021-04-20T22:47:51.0457452Z �[2m- hook id: flake8�[m
2021-04-20T22:47:51.0458319Z �[2m- duration: 8.51s�[m
2021-04-20T22:47:51.2094758Z Check for usage of lambda functions in the migration.......................�[42mPassed�[m
2021-04-20T22:47:51.2096698Z �[2m- hook id: no-lambda-in-migration�[m
2021-04-20T22:47:51.2098195Z �[2m- duration: 0.16s�[m
2021-04-20T22:47:51.2325261Z [command]/usr/bin/git diff --quiet
2021-04-20T22:47:51.2435364Z ##[group]push fixes
2021-04-20T22:47:51.2460747Z [command]/usr/bin/git config pre-commit
2021-04-20T22:47:51.2523324Z [command]/usr/bin/git config
2021-04-20T22:47:51.2581953Z [command]/usr/bin/git checkout HEAD -b feature/dropped-the-dynamic-section-variant-fill-mode
2021-04-20T22:47:51.2615873Z fatal: A branch named 'feature/dropped-the-dynamic-section-variant-fill-mode' already exists.
2021-04-20T22:47:51.2619910Z ##[endgroup]
2021-04-20T22:47:51.2626371Z ##[error]The process '/usr/bin/git' failed with exit code 128
2021-04-20T22:47:51.2756907Z Post job cleanup.

Running on v2.0.0 if that helps

    - uses: actions/checkout@v2
        fetch-depth: 0
    - name: Pre-commit
      uses: pre-commit/action@v2.0.0
        extra_args: -v --hook-stage push --all-files
        token: ${{ secrets.github_token }}

Copy link

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this was an intentional change as part of actions/checkout@v2 -- I guess we can accept the forcible checkout 🤷

@asottile asottile merged commit 1d1afd7 into pre-commit:master Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants