-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-graph.py
58 lines (49 loc) · 1.97 KB
/
generate-graph.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import requests
from random import randint
# GitHub API authentication token
TOKEN = "Your_Token"
# Base URL for GitHub API
BASE_URL = "https://api.github.com"
# Function to create a pull request
def create_pull_request(repo_owner, repo_name, base_branch, head_branch, title, body):
url = f"{BASE_URL}/repos/{repo_owner}/{repo_name}/pulls"
headers = {"Authorization": f"token {TOKEN}"}
data = {
"title": title,
"body": body,
"head": head_branch,
"base": base_branch
}
response = requests.post(url, headers=headers, json=data)
return response.json()
# Function to create an issue
def create_issue(repo_owner, repo_name, title, body):
url = f"{BASE_URL}/repos/{repo_owner}/{repo_name}/issues"
headers = {"Authorization": f"token {TOKEN}"}
data = {
"title": title,
"body": body
}
response = requests.post(url, headers=headers, json=data)
return response.json()
# Main loop to create commits
for day in range(1, 150):
for commits in range(0, randint(1, 20)):
day_str = str(day) + ' days ago'
with open('file.txt', 'a') as file:
file.write(day_str + "\n")
os.system('git add .')
os.system('git commit --date="' + day_str + '" -m "commit"')
# Customize pull request title and body
pull_request_title = "Feature: Implement new functionality"
pull_request_body = "This pull request adds new features to improve the project.\nPlease review and merge as needed."
# Create pull request
pull_request = create_pull_request("reyewka", "Bot", "main", "main", pull_request_title, pull_request_body)
print("Pull request created:", pull_request)
# Customize issue title and body
issue_title = "Bug: Fix issue with login functionality"
issue_body = "Users are reporting issues with the login process. This issue needs to be investigated and fixed promptly."
# Create issue
issue = create_issue("rewyekha", "Bot", issue_title, issue_body)
print("Issue created:", issue)