- Install Python
- Open your terminal and type
pip install requests
- Create a new file and call it
check.py
and save it inside a folder of your choice - Paste this code
import requests
import os
def search_github_issues(repos, issue_title):
token = os.getenv('GITHUB_TOKEN')
if not token:
print("GITHUB_TOKEN environment variable not set.")
return
headers = {'Authorization': f'token {token}'}
all_found_issues = {}
search_query = issue_title
for repo in repos:
search_url = f'https://api.github.com/search/issues?q={search_query}+repo:{repo}+label:"Divi Dash"+is:issue'
print(f"Searching URL: {search_url}") # Debugging line
response = requests.get(search_url, headers=headers)
if response.status_code == 200:
issues = response.json().get('items', [])
if issues:
repo_issues = []
for issue in issues:
repo_issues.append(issue['html_url'])
if repo_issues:
all_found_issues[repo] = repo_issues
else:
print(f"No issues found in {repo}.")
else:
print(f"Failed to search issues in {repo}. Status code: {response.status_code}")
print(response.json()) # Debugging line
if all_found_issues:
for index, (repo, issues) in enumerate(all_found_issues.items()):
if index > 0:
print("\n--------------------------------\n")
print(f"Issues found in {repo}:")
for issue in issues:
print(issue)
else:
print("No issues found in any repository.")
if __name__ == "__main__":
repos = ['elegantthemes/Divi', 'elegantthemes/build-laravel'] # Replace with your repository names
issue_title = input("Enter the issue title to search for: ")
search_github_issues(repos, issue_title)
- Login to your Github account
- Click on your profile picture (upper-right corner) and choose Settings from the dropdown menu
- In the left sidebar, scroll down and click on Developer settings
- Click on Tokens (classic)
- Click on Generate new Tokens(classic)
- Give your Token a descriptive name
- Under Scope select Repo (full controll)
- Scroll down and click on Generate Token
- Copy the Token to your clipboard
- On Unix/Linux/Mac type the below command in your terminal:
export GITHUB_TOKEN=your_github_token
To make this permanent, add the above line to your shell configuration file (~/.bashrc
, ~/.zshrc
, etc.).
- On Windows (Command Prompt) type the below command in your terminal
set GITHUB_TOKEN=your_github_token
- On Windows (PowerShell) type the below command in your terminal
$env:GITHUB_TOKEN="your_github_token"
- Open your terminal and
cd
intro the the folder containing thecheck.py
file - Type this command
python check.py
If you are using Python3, instead of running
python check.py
please usepython3 check.py
[video recording here]