How do I track a public repository/ organisation's progress on Github? - github

I want to track some projects hosted publicly on GitHub by others and export metrics such as the number of commits, pr merges, and issues resolved to a CSV document periodically.
I've read the GitHub docs to figure out a way to use the API to extract data, but as per my understanding, the API is for tracking projects hosted by the owner only. Any help?

Related

Can I create a pull request template that is shared across our repositories?

We have several products developed in each their repositories. We use Azure DevOps for pull requests. We have a Pull Request template that we wish to use on all repositories, hopefully maintaining in a single spot.
Is that possible and how?

Read-only access to private GitHub repository

I'm trying to figure out, if it is possible on GitHub to give someone read-only access to a specific private repository, allow only to see content, without the possibility of collaboration to contribute with change in the code or readme markup
This is only possible for private repositories managed by organisations.
https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-permission-levels-for-an-organization
If your repository is an organisation one, you can visit:
https://github.com/`OWNER`/`REPO`/settings/access
You can then add a collaborator and set their permission level to:
Read: Recommended for non-code contributors who want to view or discuss your project
Triage: Recommended for contributors who need to proactively manage issues and pull requests without write access
Write: Recommended for contributors who actively push to your project
Maintain: Recommended for project managers who need to manage the repository without access to sensitive or destructive actions
Admin: Recommended for people who need full access to the project, including sensitive and destructive actions like managing security or deleting a repository

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.

Getting Jira Issue's Branches from REST API

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