Need github repo commit list without based upon user - github-api

Im trying to get the commit list from GitHub repo using its API.
I am getting the commit list but its based upon particular user.
I need the list based upon the commit happened.
Below is the url I am using:
https://api.github.com/repos/user_name_here/repo_name_here/commits?access_token=XXXXXXXXXXX&per_page=5

It seems that the commits returns by the API will list all the commits from a particular repo, for all authors (ie not based on a user).
See for instance the commits of GitLabhq repo:
https://api.github.com/repos/gitlabhq/gitlabhq/commits
You will get all commits, without restriction. You will get both the original author and committer name as well.

Related

How to modify the pipeline name in gitlab. I am getting the Merge request title as the pipeline title

Hi anyone has any idea how to set the variable name in gitlab pipeline.
I am having an issue where the job title name is always shown as the merge request title.
I already tried finding apis to modify the title of job but to no luck.
I did find GET api/v4/projects/ of gitlab but I find something weird here as well. The title and message is not the commit message but the same MR title.
Can anyone help. Thanks in advance
[EDIT]
The commits have different messsage
The pipeline is not being run on the same commit as shown from SHA of the pipeline
The issue is basically always the MR title is being used as pipeline name
Pipeline objects don't have a "Title" attribute. What you're seeing on that page is the commit message/title. GitLab displays that so it's easy to differentiate them on the page.
These pseudo-titles will be the same in these two scenarios:
You're running multiple pipelines on the same commit, for example triggers, schedules, etc. that run against the latest commit in a branch. If there aren't new commits between these pipelines, they will run on the same commit.
If you have multiple commits with the same message. You can see this is the case in your screenshot. The commit ID sha's are different, but the commit message is the same.

Github API PushEvent

Why is it that not all commits show up as PushEvent and vice versa?
For example, the PushEvents returned from the Github API for this repo do not show the initial commit; also not all events returned from the api call show up as commits on the repo commits webpage, presumably because not all PushEvents are merged.
I need some clarification as to the relationship between PushEvents and commits as shown on a projects' github page.

how to delete a pull request with pull number using github api [duplicate]

I accidentally made a wrong pull request and ended up closing the request myself. It's in a closed state right now but it's accessible via direct URL and showing on my activity bar.
Is there any way to delete a pull request completely so it's no longer accessible via URL or shows up on your activity history?
There is no way you can delete a pull request yourself -- you and the repo owner (and all users with push access to it) can close it, but it will remain in the log. This is part of the philosophy of not denying/hiding what happened during development.
However, if there are critical reasons for deleting it (this is mainly violation of Github Terms of Service), Github support staff will delete it for you.
Whether or not they are willing to delete your PR for you is something you can easily ask them, just drop them an email at support#github.com
UPDATE: Currently Github requires support requests to be created here: https://support.github.com/contact
5 step to do what you want if you made the pull request from a forked repository:
reopen the pull request
checkout to the branch which you made the pull request
reset commit to the last master commit(that means remove all you new code). Command: git reset --hard commit_hash_here
git push --force
delete your forked repository which made the pull request
And everything is done, good luck!
This is the reply I received from Github when I asked them to delete a pull request:
"Thanks for getting in touch! Pull requests can't be deleted through the UI at the moment and we'll only delete pull requests when they contain sensitive information like passwords or other credentials."
It's very easy actually:
You can empty it, that's the best you could do.
Go to your local
Copy your local branch unwanted-branch (against which the PR was opened) to a new branch new-branch. This copying is relevant if you want to back it up for any reason. Otherwise go to step 3.
$ git branch -b new-branch
$ git merge unwanted-branch
$ git push
Empty the unwanted-branch
$ git checkout unwanted-branch
$ git reset --hard HEAD~n #n is the number of commit the branch has
$ git push -f
Enjoy, your PR is empty and closed now ;). Go to remote and delete the unwanted-branch if it bothers you.

Description of "Allow requestors to approve their own changes" is confusing

The description on this page https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops#require-a-minimum-number-of-reviewers says:
If Allow requestors to approve their own changes is selected, the creator of the pull request may vote on its approval. If not, they can still vote Approve on their pull request, but their vote won't count toward the Minimum number of reviewers.
This means it is assumed that the person that did changes on the source branch is at the same time the creator of the pull request. In our case often a different person than the developer is creating the pull request. Is this setting then only related to the creator of the pull request (and not caring about the commit pusher) or the person that pushed commits to be reviewed within the pull request?
If it is only about the creator of the pull request then the name of this setting should be changed since it has nothing to do with the actual changes (=commits) on source branch of the pull request.
Did I misunderstand something here?
Thank you
You are making a good point, Azure DevOps is implying here that the person who worked on a branch is also the initiator of the PR. This is not something that is 100% guaranteed, because it can happen that I created a dev branch, worked on code, made several commits, then my teammate creates a PR from my branch.
(The "most recent pusher" setting is probably closer to what you are looking for, which controls based on who pushed the latest commit from a local repository.)

Can you get commit information of a pullrequest using the pullrequest ID (without knowing the issue number)?

I have the pull request id of all the pull requests in a public repository. I was wondering if I could use this information to get the commit level information using Github api? I understand that this is fairly simple if the issue number is known. Unfortunately, i do not have the issue number for the pull requests.
The best you can do is to search all issues based on repo name,type (:pr) and date of creation. Using the api, the above search would translate into - https://api.github.com/search/issues?q=repo:km-Poonacha/testissues+type:pr+created:2017-06-16. I think one of the problems of using the id is that each pullrequest has an issue id and a different pullrequest id.
GitHub does not have any endpoints that allow you to filter using PullRequestevent ID. So, I guess the method you used by filtering based on type and date of creation is the best you can do for now.

Resources