Embed Github contributions graph in website

I wrote a JavaScript library to do that: github-calendar. Here is an example how to use it: <!– Prepare a container for your calendar. –> <script src=”https://cdn.rawgit.com/IonicaBizau/github-calendar/gh-pages/dist/github-calendar.min.js” > </script> <!– Optionally, include the theme (if you don’t want to struggle to write the CSS) –> <link rel=”stylesheet” href=”https://cdn.rawgit.com/IonicaBizau/github-calendar/gh-pages/dist/github-calendar.css” /> <!– Prepare a container for your …

Read more

Message “Support for password authentication was removed.”

From 2021-08-13, GitHub is no longer accepting account passwords when authenticating Git operations. You need to add a PAT (Personal Access Token) instead, and you can follow the below method to add a PAT on your system. Create Personal Access Token on GitHub From your GitHub account, go to Settings → Developer Settings → Personal …

Read more

How to find a Github file ‘s SHA blob

The docs for updating a file specify that you will need to provide the SHA for the file you will be replacing. The easiest way would be to query github for that, too. For example: > curl https://api.github.com/repos/testacc01/testrepo01/contents/test.txt { “name”: “test.txt”, “path”: “test.txt”, “sha”: “4f8a0fd8ab3537b85a64dcffa1487f4196164d78”, “size”: 13, … So, you can see what the SHA …

Read more

how to use github api token in python for requesting

Here’s some code that might help you out. Examples: Example 1 (auth): username=”user” token = ‘token’ login = requests.get(‘https://api.github.com/search/repositories?q=github+api’, auth=(username,token)) Example 2 (headers): headers = {‘Authorization’: ‘token ‘ + token} login = requests.get(‘https://api.github.com/user’, headers=headers) print(login.json()) Example 3 (delete repo): user=”username” repo = ‘some_repo’ # Delete this repo headers = {‘Authorization’: ‘token ‘ + token} login …

Read more

How to create a commit and push into repo with GitHub API v3?

Solution using the requests library: NOTES: I use the requests library to do the calls to GitHub REST API v3. 1. Get the last commit SHA of a specific branch # GET /repos/:owner/:repo/branches/:branch_name last_commit_sha = response.json()[‘commit’][‘sha’] 2. Create the blobs with the file’s content (encoding base64 or utf-8) # POST /repos/:owner/:repo/git/blobs # { # “content”: …

Read more

How can I get a list of all pull requests for a repo through the github API?

You can get all pull requests (closed, opened, merged) through the variable state. Just set state=all in the GET query, like this-> https://api.github.com/repos/:owner/:repo/pulls?state=all For more info: check the Parameters table at https://developer.github.com/v3/pulls/#list-pull-requests Edit: As per Tomáš Votruba’s comment: the default value for, “per_page=30”. The maximum is per_page=100. To get more than 100 results, you need …

Read more

How to parse link header from github API

The parse-link-header NPM module exists for this purpose; its source can be found on github under a MIT license (free for commercial use). Installation is as simple as: npm install parse-link-header Usage looks like the following: var parse = require(‘parse-link-header’); var parsed = parse(‘<https://api.github.com/repos?page=3&per_page=100>; rel=”next”, <https://api.github.com/repos?page=50&per_page=100>; rel=”last”‘) …after which one has parsed.next, parsed.last, etc: { …

Read more