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
0 answers

Mock Multiple file via PyGithub.ContentFile.ContentFile

I am newbie in test case data mocking in python, Ask is to mock 2 github files for our test cases and I am using pyGithub.ContentFile.ContentFile class to do that but the problem occurs as soon as I mock the 2nd file it overwrite the first one…
Atul Singh
  • 59
  • 1
  • 9
0
votes
0 answers

Pushing files to github folders using PyGithub

I have a github directory called "latviadebate". It looks like this: $ main . ├── index.html ├── style.css ├── images │ └── image1.png │ └── image2.png ├── pages │ └── 20-03-2023.html │ └── 08-01-2022.html So, what I need to do is…
0
votes
1 answer

github.GithubException.BadCredentialsException: 401 - but credentials are correct?

I developed a script which predicts some values and saves them into the predictions.csv file using github actions. I then need to update the predictions.csv file on github, because i need to query it externaly. But for some reason i get the bad…
0
votes
0 answers

python github api to lock the github branch of perticular repo

Want pygithub api to lock the branch as indicated in the image.enter image description here branch.edit_protection to edit protection rule
sid
  • 1
0
votes
1 answer

Appending lines to a txt file on github through pygithub

The following accesses the data from a text file on git hub. repoName = 'repo_url' filePath = 'file.txt' from github import Github g = Github(TOKEN) repo = g.get_repo(repoName) file = repo.get_contents(filePath) data =…
Spatial Digger
  • 1,883
  • 1
  • 19
  • 37
0
votes
0 answers

Accessing inputs from previous workflow runs

I am currently using the PyGithub library in order to use GitHub's API to collect all previous workflow runs for a single repo. I have been able to collect all of the workflow runs I want but I can't seem to find any information (within PyGithub's…
0
votes
0 answers

How to get all commits from a given branch with pygithub?

I am trying to get all commit messages from a specific branch form github using pyGithub in python. When I do repo.get_commits() it only returns all commits from the master branch. I know there is an existing quesiton similar to this but I could not…
Ell
  • 51
  • 6
0
votes
1 answer

PyGithub: How to move inside a git branch and list all the content that present in sub folder

from github import Github access_token = "MYACCESS_TOKEN" g=Github(access_token, retry=20) repo = g.get_repo("pygit/git") print(repo.name) branches = repo.get_branches() for branch in branches: print(branch.name) for file in…
0
votes
0 answers

Organization exists but still getting Unknown Object Error 404 with PyGithub

I am trying to get data about a few repositories through the following method: gh = Github(TOKEN) org = gh.get_organization('0xMonero') If I run the above code on any other organization, I get a valid result. But running the above code with the…
0
votes
1 answer

How do I edit a Gist with pygithub?

I am trying to edit an already created gist using the pygithub library but I have been unable to do so thus far. import github.InputFileContent from github import Github g = Github("priv key") gist =…
0
votes
0 answers

Read a CSV file with PyGithub

I just want to read a CSV file from a Github repo with PyGithub. from github import Github g = Github(token) repo = g.get_repo("user/example") contents = repo.get_contents("h.csv") with open(contents, "r") as f1: last_line =…
carlosnev
  • 1
  • 1
0
votes
0 answers

Concatting output from pygithub (python)

Working on getting data from Github but i saw that the append method is getting depricated. So now im a bit lost with the concat method. TypeError: cannot concatenate object of type ''; only Series and…
Eindbaas
  • 23
  • 4
0
votes
1 answer

python script to print the last commit message from specific git branch

from github import Github import sys import requests import subprocess from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) # github connection gc =…
0
votes
1 answer

Git Fetch Upstream with Pygithub

I’m using a lambda function to deploy code to GitHub to a forked repository with the use of Pygithub. The forked repo will create a pr to the upstream repo where changes will be reviewed. Is there a way to make git fetch upstream from the fork to…
papaya
  • 1
  • 1
0
votes
1 answer

Is there a way in Python to find the results of a Github CI?

I am using PyGithub to run tests on every pull request in a repository. I'd like to only run tests on pull requests that have passed my CI. Is there a way to query the results of the CI in Python? For example something like: for pull in…