Github : Automated tagging on Merging of Pull Requests - github

Is there a way to trigger an automatic, custom tagging of a repository every time a pull request is merged in github ? for example...
After merging "pull request 8", id like to automatically tag the repository at that state as "$Major_Version.$pr_id".
The result might be "0.1.8".
Is this possible?

Worst case, if someone hasn't written a thing to do that yet, is to use the post-receive webhooks https://help.github.com/articles/post-receive-hooks
You'd need an internet-visible web server to do this, and some code to recognize the merge (it will have two parents) and see if it mentions a pull-request.

Related

Is there a way to filter pull requests where my review is stale/dismissed?

On GitHub, I would like to be able to have a list of Pull Requests that require my attention. This must include any pull request that is created by a member of my team that was not authored by me, but requires a review from me. So far, I have this:
is:pr is:open user:<ORGANIZATION> involves:coworker involves:coworker -author:#me -reviewed-by:#me
The problem is, when my review is dismissed or becomes stale, -reviewed-by:#me filters out that pull request because I've previously reviewed it, even though that review has been dismissed. If I've already approved it or if the pull request has changes requested by me that are not outdated, I do not want to see them in the list.
Is there an online query to be able to list these pull requests from github.com/pulls?
Taking inspiration of this use-case which illustrate the power of GitHub CLI gh, you could, for each of the currently listed PR, do a check (using the "List reviews for a pull request" API):
gh api repos/<your repo name>/pulls/<PR ID>/reviews --jq '.[] | [.id,.state] | join("=")' | grep -Po '\d+(?=\=DISMISSED)'
You can add the .user.login attribute to filter on your name and check if you have, for a given PR, reviews in "DISMISSED" state.
If yes, you know you can filter you that PR from your intial query.
This is not straightforward, as some processing is needed, but it can help.

how to check any open pull request in GitHubs?

I got a coding challenge from a company and they require to complete a project on https://www.hatchways.io/
I already completed all of the code, but as I submit it shows that
{ Before you submit the Front-end Work Simulation - Hatchways Times project, you will need to pass the following pre-checks:
You must have an open pull request. ❌
You do not have multiple pull requests opened. ✅
Sorry, looks like you didn't pass all the pre-checks above. Please make sure you satisfy all the requirements before you retry. }
I have two branches one is 'main' another one is 'practice'. I already checked I don't have any pull request both of branches.
Is there anyone know how to solve it please?
Pull Request
record of pull request
Click New pull request
Set the branch to practice and the base branch to main
Submit

How can I modify the state a work item is changed to after PR?

When we create a pull request and link a work item, after the PR is completed the status of the work items are automatically changed to "invalid". How can we change that behavior to a different status?
In a recent update to Azure DevOps, you can now customize work item state when pull request is merged.
When you create a PR, in the description, you can set the state value
of the linked work items. You must follow the specific syntax.
{state value}: #ID When you merge the PR, the system reads through
the description and updates the work item state accordingly. In the
follow example we set work items #300 and #301 to Resolved, #323 and
#324 to Closed.
The Set work item state in pull request feature is also works for custom states. Here is my sample:
Add a custom state to task.
Create a new pull request and add the Description like:
Ready for QA: #id
Create pull request and complete the merge. Do not check "Complete linked work items after merging" option.
Now, the status of my task has been updated to Ready for QA.
In addition, the product group is still improving this feature. If you have any concern or suggestions, you can share it in this suggestion ticket and this one.

How to format request for github api

I'm having trouble formatting my request for the github api.
I have tried looking at the documentation and doing:
https://api.github.com/repos/facebook/react/commits/master?since=2019-01-01&until=2019-12-30
But this only returns one result instead of all commits for the year. I am using the requests library in python, and have also tried it natively in the browser.
Any help appreciated, Thanks.
You are using the Single Commit API with GET /repos/:owner/:repo/commits/:ref
You need List commits API : GET /repos/:owner/:repo/commits :
https://api.github.com/repos/facebook/react/commits?since=2019-01-01&until=2019-12-30&sha=master
You can specify the branch with sha param. If you want the default branch, you can omit this field:
https://api.github.com/repos/facebook/react/commits?since=2019-01-01&until=2019-12-30

Bitbucket web hook not posting

I have set up a web hook on Bitbucket to POST to my webserver to log some details. There is two webhooks on the repo, my custom one, and one for FTPloy.com. I have been pushing random commits to test the POST on my server etc, but after a while it stopped.
Never FTPloy.com or my own webserver receives a post request from Bitbucket after I pushed.
How is this possible/how can I fix it?
I had a hard time testing my web hook as well. I figured out that the best way to test is via command line. I copied the sample data shown here, added payload= to the beginning and saved it to a file: bb.post
Then via command line I submitted a POST request to my web hook using that file as the POST data: curl --data #bb.post http://mydomain.com/customWebHook.php
This is the best way I found to debug it.
Note: They never mention that when the last commit was from a merge, the "branch" attribute from that commit is null. Instead you need to look at "branches" attribute which is an array of the two branches that created the merge.