How can I add a participant to an Issue through the GitHub API? - github

I'm looking for a way to add a list of participants to a GitHub Issue using the GitHub API.
I have tried:
Assigning the issue through the GitHub API.
Works, adding participants, but may be too direct, and there is a limit of 10 assignees.
#mentioning users in the description and a comment.
Does not add participants
My end goal here is to create an issue representing an deploy and #mention everyone who has a PR being deployed so that they know to help test. I'd like everyone to get a GitHub notification about the issue as it is created. Adding them to the list of participants seems like it should be the best way to accomplish this.

Related

Is it possible to filter GitHub pull requests that were authored by members of a specific team

It could be useful for review purposes, for example, if one wants to review pull requests written by someone from her team.
According to GitHub's documentation1, it's possible to filter PRs by the team that was requested for review, but not if a member actually created it.
1 https://help.github.com/en/github/managing-your-work-on-github/filtering-issues-and-pull-requests
Just for completeness (after all this time): this is not possible: the UI does not allow that search. It's also not available as filter in the PR REST API's.
You might be able to do this with the GraphQL API, but I have not tried that.

Get review status of pull request from Github

Running on GitHub Enterprise I have a small Jenkins job that looks for pull-request comments and triggers a script depending on the message.
Now I only want to trigger the script if review is already done from GitHub point of view, like all CODE_OWNERS and no additional person requested changes. I don't want to implement that logic myself. GitHub has different section for reviews and status checks. I only want review state, since I am going to set the status myself.
But I was not able to the correct value from the API endpoint. Neither from pull-request itself, nor from pulls/id/reviews.
Closest that i found was "mergeable_state", but this unfortunately takes the status check into consideration.
Is there another place to look for?
I don't think you can fetch the global review status. I think that the best you can do is to check that there are no review requests and fetch all reviews to check if there are no requested changes.
Finally we decided to make a Probot app in Github which was able to get all the required information.

Automatic invites to your github organisation

At the moment for a Github organisation of mine, potential members have to be manually searched for an added. Is there way a to make your Github Organization public, so people can easily and automagically join your cause?
I am a beginner with Github, but have searched a lot and they don't seem to have this feature. Is it a plugin anywhere?
I see 2 problems, either of which would be nice to fix.
Why can't users request an invite to your organisation, even if you have to manually approve?
Why can't I send out bulk invites to say an email list? Or can I do this?
Thanks Stack Overflow
I don't know why Github doesn't offer anything like this functionality. Github Organisations seem still kind of underdone, and I look forward to them making them more useful. For the moment I have something which can help you with one of your problems.
Second Problem: Bulk Invites
After needing bulk invite students for a university club I am a part of, I created thundergolfer/automated-github-organisation-invites. It's a Heroku deploy-able web app that allows anyone with access to the URL to get themselves an organisation invite automatically.
It uses the Github API to do basically what you need. You can send out a bulk email with a link to the web app. Job Done.
First Problem: Users requesting invites
The problem with the above solution is that you don't get a chance to review who requests an invite. They are automatically added. Perhaps when I get time in the future I can extend the project above to allow you to capture requests and then review them before sending out the email.
I am not sure about the first point. But the second point should be no problem. You can use the GitHub API to invite members to your organisation. You can read more about it here:
https://developer.github.com/v3/orgs/members/#add-a-member
If using GitHub classroom then you can solve both problems. In the classroom you can add multiple email invites at the same time (or link with a LMS to get the list of people to invite automatically, both are explained here). You can also create an assignment and end up with a link that can be sent to people to join. Within an assignment there can be auto Team and Repo creation.
With your second problem another option is a python script that can bulk invite users to a GitHub organisation:
https://github.com/RobbyJ/github_batch_organisation_invite

How to filter pull requests on GitHub by commentaries authors?

There are a plenty of Pull Requests on GitHub. Each pull request goes through code review process by one of a few developers. Is there a way to filter out only those pull requests, that has been reviewed by a specific user?
I've tried multiple filters:
build-in GitHub is:open mentions:nattfodd - shows only PRs where there are replies to nattfodd's commentaries, skips PRs with nattfodd's commentaries, but w/o replies to them
simply typed nickname to search field - same behavior
Is it even possible to get what I want?
Github is already providing a very powerfull search API, which includes
Search by a commenter within an issue or pull request.
You can use the filter in the following way: commenter:nattfodd.
For more information please refer the official page here.

Receive github issue notifications but not pushes

I have 3 related github repos, with associated issue trackers. I'd like to get email when anything happens in the issues, but not whenever someone pushes, or makes a pull request. I don't see the ability to control notifications at this level of granularity.
I know that I can unsubscribe from specific threads, but that doesn't give me what I want either.
Alternatively, if there was a way to tell which type of notification it is in the email, so I can set up a filter, that would be fine too. However, I haven't been able to determine a consistent difference on that front either.
That's not possible currently using the features GitHub offers. However it may be possible using GitHub API.
I'd like to get email when anything happens in the issues, but not whenever someone pushes, or makes a pull request.
All Pull requests are issues but not all issues are Pull requests. That's being said, you cannot [currently] unsubscribe from pull requests and get the issues, since the pull requests are issues.
Since you are developer you can develop your own app to notify you (send you emails) when new issues are opened to specific projects.
Taking IonicaBizau/git-stats as example, you can access the issues like this:
https://api.github.com/repos/ionicabizau/git-stats/issues
You will get 304 Not Modified if there are no new issues. That way you can check if there were added new issues or not. Checking if the issue is pull request is done by checking if there is a pull_request field in the object, like mentioned here.
An alternative that I just found, is the Message-ID field of the email. the pull and merge emails all have <org/repo/pull/....> the issue emails have <org/repo/issue/....> so, I can filter on the Message-ID field.