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

Update repos for an Org Team #37

Merged
merged 1 commit into from
Oct 26, 2020
Merged

Update repos for an Org Team #37

merged 1 commit into from
Oct 26, 2020

Conversation

marcohutzsch1234
Copy link
Contributor

Thanks your your amazing work for creating this node module to easily rename branches in a bunch of repositorys.

This PR makes it easier to rename master -> main branche only in repositories which are linked to a team in an organization.

If parameters org and team are provided all repos an existing team
are being looked up and updated. There is no functional change
on the existing org or user parameters.

Copy link
Owner

@mheap mheap left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

It looks as though we'll fetch all repos for an org even if the team flag is provided (https://github.com/marcohutzsch1234/github-default-branch/blob/main/src/get-repos.js#L7-L16)

Could you refactor so that listForOrg is only called if args.team is not provided?

If parameters org and team are provided all repos an existing team
are being looked up and updated. There is no functional change
on the existing org or user parameters.
@marcohutzsch1234
Copy link
Contributor Author

Hi @mheap you are right, I did not exclude the full org lookup even if the team is provided. I've added the args.team condition for the listForOrg as well, so it should work now. Code does not look really DRY, but its still good readable.

I was thinking of adding the --team parameter into the front validation but decided to leave the front validation as it is, because it would only complicate stuff instead of making anything clearer.

I squashed the change into the existing commit, the PR is updated.

@mheap mheap changed the title make it possible to update all repos of a single team in an organization Update repos for an Org Team Oct 26, 2020
@mheap mheap merged commit 6d88634 into mheap:main Oct 26, 2020
@mheap
Copy link
Owner

mheap commented Oct 26, 2020

Thanks for this @marcohutzsch1234 - it's now released as github-default-branch v1.9.0

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

Successfully merging this pull request may close these issues.

2 participants