Skip to content

A demo repo showing how you can make commits to GitHub over the API in Python

License

Notifications You must be signed in to change notification settings

sgibson91/github-commits-over-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Committing files over the GitHub API with Python

pre-commit.ci status

This is a demo repo where I was testing making commits over the GitHub API using Python and the requests library. I've found this method useful when automating tasks that involve interacting with the GitHub API. It removes the need to have git installed in the environment your process is running in, and removes the need to clone the repository locally for the sake of editing one or two files.

All code can be found in the examples folder. The requirements for the code can be installed by running

pip install -r requirements.txt

To run these examples, you will need to create a Personal Access Token (the public_repo scope should be adequate) and add it to your bash environment.

export GITHUB_TOKEN="PASTE YOUR TOKEN HERE"

Each example script requires the repo to interact with, in the form user/repo, and the path to the file to edit relative to the root of the repo, e.g.:

python examples/<SCRIPT_NAME> sgibson91/github-commits-over-api README.md

Some of the more complex workflow examples may require additional inputs. You can get the help for each example by running

python examples/<SCRIPT_NAME> --help

The Examples

About

A demo repo showing how you can make commits to GitHub over the API in Python

Topics

Resources

License

Stars

Watchers

Forks