github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/api/receiver/azure.go (about)

     1  // Copyright 2018 The WPT Dashboard Project. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license that can be
     3  // found in the LICENSE file.
     4  
     5  package receiver
     6  
     7  import (
     8  	"regexp"
     9  )
    10  
    11  var (
    12  	// This is the pattern for the downloadURL field in
    13  	// https://docs.microsoft.com/en-us/rest/api/azure/devops/build/artifacts/get?view=azure-devops-rest-4.1
    14  	azureArtifactRegex = regexp.MustCompile(`/_apis/build/builds/[0-9]+/artifacts\?artifactName=([^&]+)`)
    15  )
    16  
    17  func getAzureArtifactName(url string) string {
    18  	if match := azureArtifactRegex.FindStringSubmatch(url); len(match) > 1 {
    19  		return match[1]
    20  	}
    21  
    22  	return ""
    23  }