218 questions
0
votes
0
answers
41
views
GitHub API endpoint no longer returning results for referral sources
When querying the referral sources endpoint on GitHub I'm only getting an empty list returned. I can get data for other endpoints in the same repo, even for other traffic endpoints. I'm expecting ...
0
votes
1
answer
53
views
How to unfollow someone using PyGitHub
I was wondering how would I unfollow someone using PyGithub
It's a program that unfollows every person that follows me (to follow organizations only)
I tried the following code but it gave me 404 page ...
1
vote
1
answer
241
views
Discrepancies Between GitHub API and Web Interface Search Results
I am currently facing issues with the GitHub Search API where the number of search results significantly differs from what I see on the GitHub web app. I would like to understand these discrepancies ...
0
votes
1
answer
162
views
How to get the default branch in PyGithub?
I was looking through the PyGithub documentation https://pygithub.readthedocs.io/en/latest/introduction.html but I can't find any function that returns the default branch.
In the examples, "main&...
0
votes
0
answers
81
views
edit_protection() got an unexpected keyword argument
branch.edit_protection(
enforce_admins=desired_protection_settings["enforce_admins"],
required_linear_history=desired_protection_settings["...
1
vote
0
answers
105
views
How can I tell if my github branch has a Pull Request?
I tried passing the most recent SHA to Commit.get_pulls but that does not give expected results. It returns an empty paginatedList even though I have a PR for the SHA in question . . .
I'm using ...
2
votes
1
answer
170
views
Is there a way in Python GitHub library to check if the branch for which a PR has been raised is out-of-date from it's base branch or not?
My python script is getting a list of PRs and then it needs to run a check if the branches being used in those PRs are out-of-date from their base branch or not.
I need to perform this action remotely ...
0
votes
1
answer
382
views
Using PyGithub, how do I get the last known update time for a repository?
I've been developing a portfolio website and part of the data for the projects (like the project summaries and the latest update times) are obtained through PyGithub using the project title.
When I ...
0
votes
1
answer
113
views
query github commits from a certain date using pygithub
have the following code:
from github import Github
...
g = github(token)
query = f'org:{org_name} author:{username} since=2021-10-19T00:00:00Z'
commits = g.search_commits(query, sort='author-date', ...
1
vote
1
answer
1k
views
pygithub search and read specific files
I am using pyGithub to go through the files in the Github repository. The problem is, with this code my_code.get_contents(""), it goes through each and every file in all the folders and ...
1
vote
0
answers
321
views
Github Api (PyGithub) delete/undo last commit to branch
Background
I am using a fork of the upstream repository where I created my own branch. I can commit to this branch and then create a pull request to the upstream. Committing again to the fork will ...
0
votes
0
answers
276
views
Pygithub g.get_repo() working in local but not on github hosted and self hosted runners
I have a code which is working fine in my local but not on github actions.
token = "some-token"
repo_name = "customer-sandbox/some-repo" # org/repo format
g = Github(token)
repo = ...
0
votes
0
answers
65
views
Using negative qualifiers with PyGithub
I am trying to use PyGithub to access GitHub REST API to search repos. Since, API has strict rate limits, I want to filter out as many repos possible during the search.
Before, writing the script in ...
3
votes
0
answers
558
views
How to get_projects() from github repo using PyGithub?
I'm trying to fetch projects from a github repo using PyGithub 1.58.1.
I created those projects manually in browser and I can see them.
But when I see repo.get_projects().totalCount, it's giving 0.
...
1
vote
0
answers
54
views
```AttributeError``` when attempting to call a repo action
I am receiving an error message of AttributeError when attempting to call a repo and its actions.
This is my current code:
from github import Github
#Authenticate with GitHub
g = Github("<...
1
vote
1
answer
2k
views
How to enable Require status checks to pass before merging through automation
I was reading over PyGitHub's documentation in: https://pygithub.readthedocs.io/en/latest/github_objects/Branch.html
and found some interesting methods that I thought might help
First I made sure that ...
0
votes
1
answer
1k
views
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 ...
1
vote
0
answers
143
views
Uploading multiple files to release on Github using Python
I am trying to create a release and upload all files with a specific ending as an asset. My code is as follows:
# This uploads all apkg files in the current directory to a release on GitHub.
import ...
1
vote
1
answer
320
views
Python test patch is never called
I am trying to test with my code by mocking the PyGithub library.
I want to create a repository for an organization. So first I need to get it and on the "Organization" returned object, I ...
2
votes
1
answer
4k
views
How do I programmatically extract GitHub repositories that contain a code string?
I am looking for a way to extract GitHub repositories containing files with a certain code string. I can do manually using the GitHub search bar. For instance, if I'm looking for the usages of the ...
0
votes
1
answer
249
views
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&...
0
votes
1
answer
946
views
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(...
0
votes
1
answer
363
views
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 ...
0
votes
1
answer
673
views
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.
1
vote
2
answers
692
views
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 ...