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

chore: merge forward script fails when branch is already checked out #10946

Merged
merged 2 commits into from
Oct 19, 2020

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented Oct 19, 2020

The AutoPullRequest CodeBuild job already checks out the base branch.
This causes the git checkout -b command to fail since the branch
already exists.

Update the script so that branch creation occurs only if it does not
already exist.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

The [AutoPullRequest] CodeBuild job already checks out the base branch.
This causes the `git checkout -b` command to fail since the branch
already exists.

Update the script so that branch creation occurs only if it does not
already exist.

[AutoPullRequest]: https://github.com/aws/cdk-ops/blob/21acd7ff37ad9ab14d8c3f9b41980e9f62f64503/lib/cdk-pipeline.ts#L284-L290
@nija-at nija-at requested review from rix0rrr and a team October 19, 2020 11:43
@nija-at nija-at self-assigned this Oct 19, 2020
@gitpod-io
Copy link

gitpod-io bot commented Oct 19, 2020

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 19, 2020

# create 'v2-main' if it does not already exist
(git branch --list | grep 'v2-main') || git checkout -b v2-main origin/v2-main
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm reading the man page right, this is exactly what '-B' is made to do. https://git-scm.com/docs/git-checkout

Suggested change
(git branch --list | grep 'v2-main') || git checkout -b v2-main origin/v2-main
git checkout -B v2-main origin/v2-main

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I seem to have missed that in the man page.

@njlynch njlynch added the pr/do-not-merge This PR should not be merged at this time. label Oct 19, 2020
@nija-at nija-at removed the pr/do-not-merge This PR should not be merged at this time. label Oct 19, 2020
@mergify
Copy link
Contributor

mergify bot commented Oct 19, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit ddff37c into master Oct 19, 2020
@mergify mergify bot deleted the nija-at/fix-merge-script branch October 19, 2020 12:45
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: f93d98d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants