| from urllib.parse import urlparse |
| return all([result.scheme, result.netloc, result.path]) |
| def docs_link_exists(body): |
| for line in body.splitlines(): |
| for word in line.split(): |
| if word.startswith('http') and uri_validator(word): |
| parsed_url = urlparse(word) |
| if parsed_url.netloc == "github.com": |
| parts = parsed_url.path.split('/') |
| if len(parts) == 5 and parts[1] == "frappe" and parts[2] in docs_repos: |
| if __name__ == "__main__": |
| response = requests.get("https://api.github.com/repos/frappe/erpnext/pulls/{}".format(pr)) |
| payload = response.json() |
| title = payload.get("title", "").lower() |
| head_sha = payload.get("head", {}).get("sha") |
| body = payload.get("body", "").lower() |
| if title.startswith("feat") and head_sha and "no-docs" not in body: |
| if docs_link_exists(body): |
| print("Documentation Link Found. You're Awesome! 🎉") |
| print("Documentation Link Not Found! ⚠️") |
| print("Skipping documentation checks... 🏃") |