Getting Jira Issue's Branches from REST API - rest

I am working with the Atlassian product Jira's REST API, combined with Stash. I have the two applications linked so that I can create branches in Stash for the Jira tickets. That is all working great, but what I need is a REST API call or really any call to get the branches for the issue to help automate our development process.
/rest/api/2/{issueid} // Doesn't work
The standard issue pull, Atlassian documentation https://docs.atlassian.com/jira/REST/6.0.1/#id147461, doesn't give me any information about the branches created for the issue.
The only other way I can think of to get the information is to scan every project's repo for the specific name of the ticket, which sounds wildly inefficient.
I'm using:
Jira version 6.2.6
Stash version 3.0.1

Found the rest url I was looking for and so far I have found zero documentation on it. Anyway I am going to use it as this is the actual url that Jira uses in the user interface.
{Jira App Url}/rest/dev-status/latest/issue/detail?issueId={IssueKey}&applicationType=stash&dataType=pullrequest

The docs: https://quickstart.atlassian.com/download/stash/jira-integration mention there is information about "all branches related to the issue". The decision which branch is related to which issue comes from branch name. I assume what you would like to get is "all branches that have commits related to particular issue" (issue key must be in commit message). As far as I know this is not supported at the moment.
One solution that comes to my mind is using Stash git hooks (https://blogs.atlassian.com/2013/03/stash-22-customize-workflow-git-hooks-api-merge-checks/) with custom JIRA plugin that exposes custom REST API to collect information triggered by git hook.

I'd look at the source for the JIRA part of the integration to see what REST calls it makes to stash. They're probably ones documented here: https://developer.atlassian.com/static/rest/stash/3.0.4/stash-branch-utils-rest.html
but they may also use the core REST API for Stash

Try This :
{Jira App Url}/rest/dev-status/latest/issue/detail?issueId={IssueKey}&applicationType=stash&dataType=repository

Related

Programmatically create a commit containing Git-LFS data to a Github Repository

Ether by using the GraphQL (Preferred but seems unlikely), REST API, or by any other means.
Ideally it would be possible to commit the LFS objects and regular objects in the same commit.
I have been using the GraphQL API to successfully query and download LFS objects. I was hoping that it would be possible to also create commits that contain LFS objects.
Unfortunately it seems like createCommitOnBranch doesn't provide a documented way of doing that. So I am left with looking for alternatives.
A version of this question is in the Github Community GraphQL category: https://github.community/t/create-a-commit-containing-lfs-data-via-graphql/252637

Is there a way to retrieve Github repositories whose language has been changed?

I am trying to get all repositories whose language was Java but had changed to Kotlin and vice versa.
Does anyone know if it's possible to filter these repositories with the Github api?
If you are looking to compare before/after, in terms of a programming languages for particular GitHub repos, I'm not sure you can do that short of having a big-data project.
If you want to filter GitHub repos by programming language, the GitHub API documentation states:
Suppose you want to search for popular Tetris repositories written in Assembly. Your query might look like this.
curl https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc
Also,
Checkout my open-soure project Git-Captain, which may help you.
It's an open-source web-application built with Node.js utilizing GitHub API to find, create, and delete a branch throughout numerous GitHub repositories.
Can be setup for organizations or a single user.
I have a step-by-step how to set it up on a server to communicate with the GitHub API.

GitHub API - Equivalent of GitLab's Protected branch API

There is a feature named Protected branches API on GitLab API. Basically, you can restrict all the push and merge access by setting their levels to 0.
I have checked Branches section on GitHub REST API document but I couldn't find the equivalent API. How can I restrict merge and push to a branch on GitHub? Also, I want to remove this restriction after some operations.
protect master branch (do not allow any push, merge etc.)
do something
unprotect master branch
Going to the github api documentation, I see they have added protections. This seems pretty clear how to add proctections using API now.
I don't know a way using the API, but in the UI, you can go to settings > branches and then add some protection rules
You can read more about it here

GitHub REST API: Commits per release

I'm trying to obtain the commits that were included on an specific release, on a repository that uses tags to identify releases. According to this answer, this doable through git log.
However, I need to gather this information for several repositories, so using an API is more convenient. Is it possible to get that information from GitHub's REST API?
You can use the compare two commits API:
GET /repos/:owner/:repo/compare/:base...:head
This is the same as locally running git log base..head.
Given that you want to automate this for several repos check List your Repositories API as well
Let me know if you need more info.

Create GitHub issue from Freshdesk

We are currently using Freshdesk for our customer support and GitHub for our code. On receiving a bug or an improvement feature request via Freshdesk, we would like to forward that ticket (with all the details + screenshots) to an email in GitHub so an issue is created automatically on GitHub. That would save us a manual entry.
Look forward to an advice on this or a better solution.
NOTE: Had come across https://zapier.com/zapbook/gmail/github/72/create-github-issue-email , but we would prefer a direct interaction without a third-party app in between.
Creating an issue to GitHub wouldn't be done by "sending an email", but only by using the GitHub v3 issue API (like this script, for example, to migrate issues to GitHub)
That means in your case having a trigger on FreshDesk (or an "Observer" to call a webhook) which would parse the ticket and create the appropriate bug report on GitHub.
From the Observer/WebHook help page:
Webhooks also come handy when you want to trigger an action in an external application or tool (as well as some updates that the Observer can't perform, like update time entry on a ticket or add a note to a ticket)
You would manage that webhook locally on your side, and that callback would in turn call the right GitHub API commands to create the GitHub issue.
We had similar needs and built a very simple tool to let anyone in the team send/forward emails to create GitHub issues. We were using it internally at first so that non engineering team members didn't have to go to GitHub to create issues. We just made it available to anyone (and free). It supports attachments.
You can find it at https://fire.fundersclub.com.