Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate maintaners url #52 #57

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions first/repos/amireshoon/Black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Black
description: A personal static site
maintainers:
- amireshoon
languages:
- javascript
6 changes: 6 additions & 0 deletions first/repos/amireshoon/Friends.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Friends Show
description: A collection of popular and funny friends show quotes
maintainers:
- amireshoon
languages:
- markdown
6 changes: 6 additions & 0 deletions first/repos/amireshoon/gow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: gow
description: A CLI tool to manage todos and works and can manage TODO.md
maintainers:
- amireshoon
languages:
- go
7 changes: 7 additions & 0 deletions first/repos/amireshoon/minifyAction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: MinifyAction
description: Minify CSS, Js, and Html files on push to Main or Another Branch with Github Actions
maintainers:
- amireshoon
languages:
- shell
- python
31 changes: 26 additions & 5 deletions scripts/validate_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,39 @@
import os
import sys
import urllib.request
from util.github import github_repo_url
from util.github import github_repo_url, GITHUB_BASE
from util.repos import load_repos

owners_check = []

def check_repo(owner, repo):
def make_request(url) -> bool:
try:
with urllib.request.urlopen(github_repo_url(owner, repo)) as response:
with urllib.request.urlopen(url) as response:
if response.status != 200:
print(f'❌ failed: {owner}/{repo}')
return False
else:
print(f'✅ passed: {owner}/{repo}')
return True
except:
return False

def check_maintainers_name(owner):
if [owner, True] in owners_check:
print(f'✅ already passed: {owner}')
return True

if make_request(f"{GITHUB_BASE}/{owner}"):
owners_check.append([owner, True])
print(f'✅ passed: {owner}')
return True
else:
print(f'❌ failed: {owner}')
return False

def check_repo(owner, repo):
if make_request(github_repo_url(owner, repo)):
print(f'✅ passed: {owner}/{repo}')
return True
else:
print(f'❌ failed: {owner}/{repo}')
return False

Expand All @@ -27,6 +46,8 @@ def check_repos(repos):
checked += 1
if not check_repo(repo['owner'], repo['slug']):
errors += 1
if not check_maintainers_name(repo['owner']):
errors += 1

return checked, errors

Expand Down