Is it possible to change the URL of the gist containing the CLA? - github

I use cla-assistant as my GitHub Contributor License Agreement (CLA) management bot.
Is it possible to change the URL of the gist containing the CLA? (without having to export the list of users who signed the CLA, unlink the repository, relink the repository with a a new gist URL and import the user list)

This isn't possible.
From one of the repository maintainers on https://github.com/cla-assistant/cla-assistant/issues/223:
unfortunately not. It works only the (long) way you have described.

Related

How to give write permission to a team for a repository using Octokit/GitHub API?

I'm using JavaScript and Octokit to dynamically create repositories in an organization and set a series of options.
Everything works, except adding write permissions to a team for the repository created.
Just to be clear, by write permission I mean the ones that can be set through the repository settings:
Settings > Collaborators and teams > Manage Acccess > Role: Write
What I've been trying to use so far, was the octokit.rest.teams.addOrUpdateRepoPermissionsInOrg function in Octokit, documented here, like this:
octokit.rest.teams.addOrUpdateRepoPermissionsInOrg({
org: "org-name",
team_slug: "team-name",
owner: "owner-name",
repo: "repo-name",
permission: "write",
}
When doing this, I receive a Validation Failed error.
Checking the relative documentation on the GitHub API docs, it effectively seems that the valid values for permission are: pull, push, admin, maintain, triage
So I guess that I'm simply using the wrong function.
But what's the correct one to change that kind of permission?
I managed to make it work: apparently, the push permission in the API corresponds to the write permission in the GitHub web interface.
FYI: this seems like a discrepancy, so I opened an issue.

Azure DevOps/VSTS REST API does not get changes of a changeset

I'm trying to to get the changes of a changeset but it returns 404. I used this:
https://<myname>.visualstudio.com/<projectname>/_apis/tfvc/changesets/291/changes
changeset exists
without the '/changes' it works, returns the changeset info but I also need the merge sources
tried to specify the API version (e.g.: api-version-5.0)
I created a full control Personal Access Token for the client app but no luck. I tried to use this link in the browser and I got the same result: it works only without '/changes'.
What did I wrong?
As this is an old Q, this is for anyone else who has same problem, The projectname needs to be removed from the request.
https://<myname>.visualstudio.com/_apis/tfvc/changesets/291/changes
You look at the docs and sure enough it's not there but most other REST calls require a project name, so it can be confusing.
Also the docs are not very clear that you can interchange https://{myName}.visualstudio.com/ for the documented https://dev.azure.com/{organization}

Get a list of who has what access to git repositories

Using VSTS APIs, I'm trying to get a list of who has what access to each of our git repositories in VSTS.
I have the security namespaceId for Git and I pass this namespaceId to the Security -> Access Control List API described here:
https://www.visualstudio.com/en-us/docs/integrate/api/security/acls
GET https://xxxxxxxx.visualstudio.com/DefaultCollection/_apis/accesscontrollists/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/?api-version=1.0&recurse=true&includeExtendedInfo=false
Drilling into the response, I can see it is listing the permissions for each repo, along with ref and tags.
Each object contains "acesDictionary", which itself is an object with keys that look like this:
Microsoft.IdentityModel.Claims.ClaimsIdentity;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\\emailaddress#example.com
How do I decipher a ClaimsIdentity? My first thought was that the UUID in the ClaimsIdentity is the UUID of the user in my VSTS project, but it is not. I know the email address is there so I suppose I could use that, but now I'm curious what the UUID in ClaimsIdentity represent. The VSTS API docs dont mention this.
Is Security -> Access Control Lists even the right place where I should be looking? My main goal is trying to get a list of who has what access to VSTS git repositories.
Through tech support, I was able to reach a Microsoft representative who shared with me that the documentation for mapping identity descriptors isn't available yet but will hopefully be released soon. In the meantime, there is an endpoint to crosswalk identity descriptors which looks something like this:
GET {account}.vssps.visualstudio.com/_apis/identities?descriptors={commaSeparatedDescriptorsList}&api-version={apiVersion}
Note that this call is made through SPS {account}.vssps.visualstudio.com and not through your account instance {account}.visualstudio.com
Using my example, it would look something like this (uuid obfuscated):
https://xxxxx.vssps.visualstudio.com/_apis/identities?descriptors=Microsoft.TeamFoundation.ServiceIdentity;ffead5b1-5121-4e0e-a439-bbecb4999eba:Build:c4bfb762-a246-46c9-ba9a-7e6c53386b11&api-version=4.0
Also, if the descriptor is of type Microsoft.IdentityModel.Claims.ClaimsIdentity, then you'll likely have escaped backslashes in your descriptor which you'll need to un-escape. For example, if you have:
"Microsoft.IdentityModel.Claims.ClaimsIdentity;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\\someone#example.com"
You'll need to un-escape this descriptor so that it looks like this:
"Microsoft.IdentityModel.Claims.ClaimsIdentity;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\someone#example.com"

Where can I find the GitHub ID in my account?

What is the difference between GitHub username and GitHub ID? I was asked for my Github ID for a certain project and I happened to give my username. But the person is unable to find me on GitHub with my username. So I got a GitHub ID from the below URL:
http://caius.github.io/github_id/
But I'm unable to find this ID from my account directly. Where can I find this in my GitHub account? It would be great if someone could elaborate on this.
Thank You.
It can be easily retrieved using GitHub API:
https://api.github.com/users/your_github_user_name
where instead of your_github_user_name you must use the desired GitHub username.
Example:
https://api.github.com/users/github
It can be easily retrieved using Github API.
Example: https://api.github.com/users/username
It can be easily retrieved using Github API. If you cannot use the API answer or from http://caius.github.io/github_id/ you can go to github --> settings --> emails , under the Primary email address you will find {id}+{user_name}#users.noreply.github.com. The format is simillar to this: 50826640+hirwablessing#users.noreply.github.com, that 50826640 is the id.
From this answer
If you cannot use the API answer or from http://caius.github.io/github_id/ you can go to github --> settings --> emails, under the Primary email address you will find {id}+{user_name}#users.noreply.github.com.
This is at least true if you have Keep my email address private checked.
I have this text in the Keep my email address private explanation, and I'm guessing this will be there even if it is turned off.
Look for 'noreply' in the emails section.
If you do have the GitHub Id but need to find the username / login you can do it like this with the List users endpoint:
Subtract the id by 1 and run the following query. My GitHub Id is 4015237 and therefore the query parameter since receives the value 4015236.
https://api.github.com/users?since=4015236&per_page=1
https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#list-users
Description for since:
Query parameters - since - A user ID. Only return users with an ID
greater than this ID.
Don't use the ID stated in other answers I tried this and it didn't work and said it was invalid on AWS.
It's located on the main GIT repository. Those random letters and numbers are below the add file button with no description, obviously. Not only that but it's clickable if you click into it you'll find a much longer commit ID. You want the longer one.
Everyone loves completely unnecessary complexity in a platform!!
Step-1: Go to this link:
https://caius.github.io/github_id/
Step-2 Enter your Github username
You got it!
The second method is:
Go to your GitHub account and click on the Settings option.
Go to the emails section.
You id is listed there. The format is:
{id}+{user_name}#users.noreply.github.com

How to leave a message for a github.com user

Need help on GitHub usage. I wonder if there is a way to communicate with a github.com user i.e. write the user a message when only username/id is given on their GitHub page? Does GitHub have this social feature?
Although GitHub removed the private messaging feature, there's still an alternative.
GitHub host git repositories. If the user you're willing to communicate with has ever committed some code, there are good chances you may reach your goal. Indeed, within each commit is stored some information about the author of the change or the one who accepted it.
Provided you're really dying to exchange with user user_test
Display the public activity page of the user: https://github.com/user_test?tab=activity
Search for an event stating "user_test pushed to [branch] at [repository]". There are usually good chances, they may have pushed one of his own commits. Ensure this is the case by clicking on the "View comparison..." link and make sure the user is listed as one of the committers.
Clone on your local machine the repository they pushed to: git clone https://github.com/..../repository.git
Checkout the branch they pushed to: git checkout [branch]
Display the latest commits: git log -50
As a committer/author, an email should be displayed along with the commit data.
Note: Every warning related to unsolicited email should apply there. Do not spam.
This method was working as of Jan 2023
Copy and paste the next line into your browser (feel free to
bookmark it): https://api.github.com/users/xxxxxxx/events/public
Find the GitHub username for which you want the email. Replace the
xxxxxxx in the URL with the person's GitHub username. Hit Enter.
Press Ctrl+F and search for “email”.
As suggested by qbolec, the above steps can be done by using this snippet:
<input id=username type="text" placeholder="github username or repo link">
<button onclick="fetch(`https://api.github.com/users/${username.value.replace(/^.*com[/]([^/]*).*$/,'$1')}/events/public`).then(e=> e.json()).then(e => [...new Set([].concat.apply([],e.filter(x => x.type==='PushEvent').map(x => x.payload.commits.map(c => c.author.email)))).values()]).then(x => results.innerText = x)">GO</button>
<div id=results></div>
Source: Matthew Ferree # Sourcecon
Simply create a dummy repo, open a new issue and use #xxxxx to notify the affected user.
If user has notification via e-mail enabled they will get an e-mail, if not they will notice on next login.
No need to search for e-mail address in commits or activity stream and privacy is respected.
For lazy people, like me, a snippet based on Nikhil's solution
<input id=username type="text" placeholder="github username or repo link">
<button onclick="fetch(`https://api.github.com/users/${username.value.replace(/^.*com[/]([^/]*).*$/,'$1')}/events/public`).then(e=> e.json()).then(e => [...new Set([].concat.apply([],e.filter(x => x.type==='PushEvent').map(x => x.payload.commits.map(c => c.author.email)))).values()]).then(x => results.innerText = x)">GO</button>
<div id=results></div>
Github said on April 3rd 2012 :
Today we're removing two features. They've been gathering dust for a while and it's time to throw them out : Fork Queue & Private Messaging
Source
Here is another way:
Browse someone's commit history (Click commits which is next to branch to see the whole commit history)
Click the commit that with the person's username because there might be so many of them
Then you should see the web address has a hash concatenated to the URL. Add .patch to this commit URL
You will probably see the person's email address there
Example: https://github.com/[username]/[reponame]/commit/[hash].patch
Source: Chris Herron # Sourcecon
Besides the removal of the github messaging service, usage was often not necessary due to many githubbers communicating with- and advocating twitter.
The advantage is that there is:
full transparency
better coverage
better search features for tweets
better archiving, for instance by the US Library of Congress
It is probably no coincidence that stackoverflow doesn't allow private messaging either, to ensure full transparency. The entire messaging issue is thoroughly discussed on meta-stackoverflow here.
Does GitHub have this social feature?
If the commit email is kept private, GitHub now (July 2020) proposes:
Users and organizations can now add Twitter usernames to their GitHub profiles
You can now add your Twitter username to your GitHub profile directly from your profile page, via profile settings, and also the REST API.
We've also added the latest changes:
Organization admins can now add Twitter usernames to their profile via organization profile settings and the REST API.
All users are now able to see Twitter usernames on user and organization profiles, as well as via the REST and GraphQL APIs.
When sponsorable maintainers and organizations add Twitter usernames to their profiles, we'll encourage new sponsors to include that Twitter username when they share their sponsorships on Twitter.
That could be a workaround to leave a message to a GitHub user.
Simplest solution that worked for me very well is just to put the username of that particular user or repository link of corresponding user!
<input id=username type="text" placeholder="Github Username or Repo link">
<button onclick="fetch(`https://api.github.com/users/${username.value.replace(/^.*com[/]([^/]*).*$/,'$1')}/events/public`).then(e=> e.json()).then(e => [...new Set([].concat.apply([],e.filter(x => x.type==='PushEvent').map(x => x.payload.commits.map(c => c.author.email)))).values()]).then(x => results.innerText = x)">GO, Get email!</button>
<div id=results></div>