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

✨ ENH: Auto-detecting the target #45

Merged
merged 9 commits into from
May 14, 2021
Merged

✨ ENH: Auto-detecting the target #45

merged 9 commits into from
May 14, 2021

Conversation

choldgraf
Copy link
Member

@choldgraf choldgraf commented Feb 27, 2021

closes #21

@choldgraf choldgraf marked this pull request as draft February 27, 2021 20:47
Comment on lines 533 to 536
response = requests.get(f"https://github.com/gitapi/repos/{org}/{repo}/git/refs/tags")
response.raise_for_status()
tags = response.json()
latest_tag = list(tags)[-1]
return latest_tag["ref"].split("/tags/")[-1]
out = run("git describe --tags".split(), stdout=PIPE)
tag = out.stdout.decode().rsplit('-', 2)[0]
return tag
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will only be the same if the local repo is updated, but I think it's fine and may make sense to check using the local repo's latest tag rather than remote repos anyhow.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah the other challenge I realized is that using the GitHub API here doesn't sort by latest updated, it sorts alpha-numerically on the tag name. So this will make it more likely we get the latest tag

Comment on lines +135 to +138
if "upstream" in remotes:
ref = remotes["upstream"]
elif "origin" in remotes:
ref = remotes["origin"]

This comment was marked as resolved.

@consideRatio
Copy link
Collaborator

I'm very happy about this feature!! ❤️ 🎉

@choldgraf choldgraf marked this pull request as ready for review February 27, 2021 21:06
Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
@choldgraf choldgraf changed the title Auto-detecting the target NEW: Auto-detecting the target Feb 27, 2021
@choldgraf
Copy link
Member Author

ok I think that this is ready to go! I also fixed up our test CI/CD so it'll run properly now. @consideRatio lemme know if you have any other suggestions!

@choldgraf choldgraf changed the title NEW: Auto-detecting the target ENH: Auto-detecting the target Feb 27, 2021
docs/index.md Outdated Show resolved Hide resolved
@consideRatio
Copy link
Collaborator

All systems go!

Copy link
Collaborator

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

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

Tried locally, had some issues, will report back.

@choldgraf I've created a PR to this PR resolving the issue I experienced, related to having a SSH based git remote -v reference.

@choldgraf
Copy link
Member Author

ok - got the tests working! I think we actually fixed a bug in the regression tests that I didn't catch before. Gonna merge this one!

@choldgraf choldgraf changed the title ENH: Auto-detecting the target ✨ ENH: Auto-detecting the target May 14, 2021
@choldgraf choldgraf merged commit 8180a51 into master May 14, 2021
@choldgraf choldgraf deleted the auto-target branch May 14, 2021 02:04
@blink1073 blink1073 added the enhancement New feature or request label Dec 1, 2021
@blink1073 blink1073 added this to the 0.2 milestone Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: finding and using a default target repo when used from a local git repo
3 participants