GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — codinit-backend/scripts/check_cla.py at main · codinit-dev/codinit-backend Expand file tree/ Copy pathcheck_cla.pyMore file actions executable file ·96 lines (78 loc) · 3.26 KB / Copy pathcheck_cla.pyFile metadata and controlsexecutable file ·96 lines (78 loc) · 3.26 KB 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 #!/usr/bin/env python3 import os import re import sys import urllib.error import urllib.request from typing import Optional CLA_TEXT = "By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." ORGANIZATION = "get-convex" def is_org_member(username: str, github_token: Optional[str]) -> Optional[bool]: """ Check if a user is a member of the get-convex GitHub organization. Returns True if the user is a confirmed member. Returns False if the user is not a member (404 response). Returns None if the check fails (network error, API error, etc.). """ try: # GitHub API endpoint to check organization membership url = f"https://api.github.com/orgs/{ORGANIZATION}/members/{username}" headers = { "Accept": "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28", } if github_token: headers["Authorization"] = f"Bearer {github_token}" request = urllib.request.Request(url, headers=headers) # Try to fetch the membership status # A 204 response means the user is a confirmed member # A 404 response means the user is not a member (or membership is private) # Other errors indicate API failure and we return None to show a warning try: with urllib.request.urlopen(request) as response: if response.status == 204: return True return None except urllib.error.HTTPError as e: if e.code == 404: # User is not a member or membership is private return False # For other HTTP errors, return None to indicate failure return None except Exception as e: print(f"⚠️ Warning: Failed to check organization membership: {e}") return None def main() -> None: # Get PR description try: PR_DESCRIPTION = os.environ["PR_DESCRIPTION"] except KeyError: print("❌ Error: There was no pull request description given") sys.exit(1) # Get PR author username - this should always be set PR_AUTHOR = os.environ.get("PR_AUTHOR") GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") if not PR_AUTHOR: print("❌ Error: PR_AUTHOR environment variable not set") sys.exit(1) # Check if the author is a member of get-convex organization member_status = is_org_member(PR_AUTHOR, GITHUB_TOKEN) if member_status is True: print( f"✅ Skipping CLA check: {PR_AUTHOR} is a member of the {ORGANIZATION} organization (Convex employee/contractor)" ) sys.exit(0) elif member_status is None: print( f"⚠️ Warning: Could not verify organization membership for {PR_AUTHOR}. Proceeding with CLA check." ) # Proceed with standard CLA check if not re.search(re.escape(CLA_TEXT), PR_DESCRIPTION, re.MULTILINE): print( "❌ Pull request description does not include the required CLA text. Please add the following text to your PR description:\n\n" + CLA_TEXT ) sys.exit(1) print("✅ CLA text found in PR description") if __name__ == "__main__": main() |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |