Skip to content

Commit

Permalink
Update .yml
Browse files Browse the repository at this point in the history
  • Loading branch information
creator-codie authored Apr 28, 2024
1 parent 062eed9 commit 8eba722
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import requests

def create_repo(token, name, private=True):
""" Create a GitHub repository via the GitHub API. """
url = "https://api.github.com/user/repos"
headers = {
"Authorization": f"token {token}",
"Accept": "application/vnd.github.v3+json"
}
data = {
"name": name,
"private": private,
"auto_init": True, # Automatically create an initial commit with empty README
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
print(f"Repository {name} created successfully.")
return response.json()
else:
print(f"Failed to create repository: {response.content}")
return None

# Usage
# Replace 'your_github_token_here' with your actual GitHub personal access token
create_repo('your_github_token_here', 'NewRepositoryName')

0 comments on commit 8eba722

Please sign in to comment.