Questions tagged [pygithub]

PyGitHub is a Python library implementing the GitHub REST API v3, to manage GitHub resources (repositories, user profiles, organizations, etc.) from Python scripts.

PyGitHub is a Python library implementing the GitHub API v3, to manage GitHub resources (repositories, user profiles, organizations, etc.) from Python scripts.

See also

210 questions
0
votes
1 answer

How to check if public git repository is updated?

I would like to know how can one check that public git repository is updated or not (if their are new commits) using python. Help in this regard would be appreciated.
iq tech
  • 49
  • 3
  • 12
0
votes
0 answers

Update a file in GitHub using a local file

I am trying to write a script to update the contents of a file in a GitHub repo. I have a File.txt that has the required data. Here's the code I've written from github import Github g = Github(ACCESS_TOKEN) repo = g.get_repo(REPO_NAME) contents =…
0
votes
2 answers

Download Repository to local folder and overwrite existing files by using Python

I have the problem that I want to update/overwrite my local folder with a Repository, but I cant find information about how I can do that with Python. When I am cloning it I have to have a empty folder which is not the case for me. Thank in…
0
votes
1 answer

PyGithub - Can't set attribute error while trying to change default branch

I've written this code to change the default branch from "master" to "release". from github import Github g = Github("github token", verify=False, base_url="url to repo") repo = g.get_repo("repo name") repo.default_branch = 'release' I am getting…
0
votes
0 answers

How to sign a commit in PyGithub?

I am currently using this method (PyGithub's update_file) to commit and push changes to a external repo. The commits are not getting signed. Is there any way to get the commit signed/verified like in the attached image? Code overview: g =…
0
votes
1 answer

PyGithub and Python 3.6

I have the following script that grabs a repository from Github using PYGitHub import logging import getpass import os from github import Github, Repository as Repository, UnknownObjectException GITHUB_URL =…
Allen Fisher
  • 607
  • 2
  • 7
  • 28
0
votes
0 answers

What is causing 404s when merging a branch using PyGithub?

I’m trying to (fast-forward) merge a branch using PyGithub in a test-bed repository, however it always returns a 404: #!/usr/bin/env python import os from github import Github from github.GithubException import GithubException github =…
Erik Ogan
  • 21
  • 2
0
votes
2 answers

How to append to a file using PyGithub?

I want to append to an already existing .txt file using PyGithub in Python. I have tried this code: git = Github(TOKEN) repo = git.get_repo("Repository") file = repo.get_contents("Textfile.txt", ref="Ref") repo.update_file(file.path, "test", "Text…
0
votes
1 answer

In PyGitHub, how do you set set_labels?

I am building a GitHub action that, gets existing issue labels adds correct priority labels sets all labels The relevant part is, def required_labels(current_labels, required_priority): if current_labels is None: return…
James Geddes
  • 742
  • 3
  • 10
  • 35
0
votes
1 answer

How can I check if a given file is present in a Github repository using PyGithub?

file path = repo_name/abc/xyz.yml repo (is the git repo object) I want to be able to check if the repo consists of the file by returning a Boolean. something like: def fileInRepo(repo, filePath): if filePath in repo.files: return true …
0
votes
1 answer

Get values StatsCommitActivity from pygithub

I want get stats "additions" and "deletions" GitHub rep. I try: #!pip install PyGithub from github import Github g = Github("token") repo = g.get_repo("bitcoin/bitcoin") active =…
altblog
  • 15
  • 1
  • 4
0
votes
0 answers

How do I check for a specific string in a specific file through all the commits of each release branch?

Currently, our department has a working python script that utilizes the pyGithub library and API to check/match for a specific string in a specific file. It checks all release branches that were created and states if there is a match. The issue is…
0
votes
1 answer

Read and upload to GitHub non UTF-8 file Python

I have code thats upload SQlite3 file to GitHub(module PyGithub). import github with open('server.db', 'r') as file: content = file.read() g = github.Github('token') repo = g.get_user().get_repo("my-repo") file =…
mooncdx
  • 46
  • 5
0
votes
2 answers

How to add a user to the github organization repository using pygithub?

I needed to add the user to the github organization repository but couldn't find anything.
0
votes
2 answers

Creating a repository and commiting multiple files with PyGithub

I want to create a new empty repository and add two files to it. However, I am stuck at adding two files with a single commit. This is my current…
Raj Tiwari
  • 13
  • 5