tasks/test.py
def lint_teamassignment(_):
    """
    Make sure PRs are assigned a team label
    """
    branch = os.environ.get("CIRCLE_BRANCH")
    pr_url = os.environ.get("CIRCLE_PULL_REQUEST")

    if branch == DEFAULT_BRANCH:
        print(f"Running on {DEFAULT_BRANCH}, skipping check for team assignment.")
    elif pr_url:
        import requests

        pr_id = pr_url.rsplit('/')[-1]

        res = requests.get(f"https://api.github.com/repos/DataDog/datadog-agent/issues/{pr_id}")
        issue = res.json()

        for label in issue.get('labels', {}):
            if re.match('team/', label['name']):
                print(f"Team Assignment: {label['name']}")
                return

        print(f"PR {pr_url} requires team assignment")
        raise Exit(code=1)

    # No PR is associated with this build: given that we have the "run only on PRs" setting activated,
    # this can only happen when we're building on a tag. We don't need to check for a team assignment.
    else:
        print("PR not found, skipping check for team assignment.")

    Make sure PRs are assigned a team label
    
Make sure PRs are assigned a team label
Make sure PRs are assigned a team label
def lint_teamassignment(_):
    branch = os.environ.get("CIRCLE_BRANCH")
    pr_url = os.environ.get("CIRCLE_PULL_REQUEST")
    if branch == DEFAULT_BRANCH:
        print(f"Running on {DEFAULT_BRANCH}, skipping check for team assignment.")
    elif pr_url:
        import requests
        pr_id = pr_url.rsplit('/')[-1]
        res = requests.get(f"https://api.github.com/repos/DataDog/datadog-agent/issues/{pr_id}")
        issue = res.json()
        for label in issue.get('labels', {}):
            if re.match('team/', label['name']):
                print(f"Team Assignment: {label['name']}")
                return
        print(f"PR {pr_url} requires team assignment")
        raise Exit(code=1)
    else:
        print("PR not found, skipping check for team assignment.")
def lint_teamassignment ( _ ) : branch = os . environ . get ( "CIRCLE_BRANCH" ) pr_url = os . environ . get ( "CIRCLE_PULL_REQUEST" ) if branch == DEFAULT_BRANCH : print ( f"Running on {DEFAULT_BRANCH}, skipping check for team assignment." ) elif pr_url : import requests pr_id = pr_url . rsplit ( '/' ) [ - 1 ] res = requests . get ( f"https://api.github.com/repos/DataDog/datadog-agent/issues/{pr_id}" ) issue = res . json ( ) for label in issue . get ( 'labels' , { } ) : if re . match ( 'team/' , label [ 'name' ] ) : print ( f"Team Assignment: {label['name']}" ) return print ( f"PR {pr_url} requires team assignment" ) raise Exit ( code = 1 ) else : print ( "PR not found, skipping check for team assignment." )
Make sure PRs are assigned a team label
Make sure PRs are assigned a team label
"""
    Make sure PRs are assigned a team label
    """ # No PR is associated with this build: given that we have the "run only on PRs" setting activated, # this can only happen when we're building on a tag. We don't need to check for a team assignment.
_