Closed ib-ak closed 3 years ago
Sorry, I can't quite follow your description here. Am I right, that you're doing something link this in your workflow? (See pseudo-code below)
# At the start of the Workflow, the repo is checked out to the default branch
# by using actions/checkout@v2
git checkout main
# You then immediately create/switch to a new branch
git checkout -b other-branch
# You do a thing to your code which you want to automatically commit
touch foo.txt
# You then run git-auto-commit
stefanzweifel/git-auto-commit-action@v4
# You now expect that the `other-branch`-branch exists on GitHub with
# the changes you made to your code.
It would be awesome if you could share more details of your Workflow or what you want to achieve. We could then write a test case for that and maybe implement the necessary changes.
Meanwhile, have you tried using the branch
config for the Action?
- uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: feature-123
If you provide a branch
option, the Action will create a new branch on remote.
https://github.com/stefanzweifel/git-auto-commit-action/blob/master/entrypoint.sh#L115
I think we are on same page.
I did try branch option with a new branch name it fails here https://github.com/stefanzweifel/git-auto-commit-action/blob/520c63c1719172f8c9682bf244016d9471e7934a/entrypoint.sh#L53
since that branch is not present it cannot do a checkout
@abhinavkhanna-sf I've created a PR with a possible solution in #140.
Could you please test this in your workflows by updating your workflows like this?
-- uses: stefanzweifel/git-auto-commit-action@v4
+- uses: stefanzweifel/git-auto-commit-action@feature/create-new-branch-during-checkout
If this solves the problem for you, I would tag a new release in the next days.
Is your feature request related to a problem? Please describe. Action expects remote branch to be present. It tries to checkout the branch name.
Describe the solution you'd like While switching to "branch" after fetch, if branch is not found,
Describe alternatives you've considered None
Additional context Add any other context or screenshots about the feature request here.