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

Check if a branch has been merged? #2932

Open
guymatz opened this issue Mar 27, 2024 · 2 comments
Open

Check if a branch has been merged? #2932

guymatz opened this issue Mar 27, 2024 · 2 comments

Comments

@guymatz
Copy link

guymatz commented Mar 27, 2024

Hi! Thank you for all you do! Is it possible to check if a branch has been merged?

@xvega
Copy link
Contributor

xvega commented Mar 31, 2024

Hi! Thank you for all you do! Is it possible to check if a branch has been merged?

Hello @guymatz

I noticed this was posted as an issue; it's actually a perfect question for the PyGitHub Discussions Q&A section. Where you can ask the community for help

Stack Overflow is also a good place for reaching a broader audience with the pygithub tag.

Issues are best reserved for bug reports or feature suggestions, helping maintainers or people looking into issues to contribute solutions to prioritize development work. As PyGithub is seeking new maintainers, #2205

To answer your question:

It's possible to check if a branch has been merged:

  • For a PR check the merged_at field in the response.
  • For a branch you can do it this way:
base = "main"
head = "your_branch"

comparison = repo.compare(base, head)

That's using this endpoint

@guymatz
Copy link
Author

guymatz commented Apr 3, 2024

Yes, of course. Sorry! Thanks!!

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

No branches or pull requests

2 participants