@@ -21,6 +21,13 @@ export type LinearChangesetSdkReleaseIssuesBody = InferOutput<
21
21
typeof LinearChangesetSdkReleaseIssuesBody
22
22
>
23
23
24
+ type GetProjectVersionsResponse = {
25
+ releases : {
26
+ appName : string
27
+ version : string
28
+ } [ ]
29
+ }
30
+
24
31
export class LinearChangesetSdk {
25
32
constructor ( private readonly url : string ) { }
26
33
@@ -37,20 +44,24 @@ export class LinearChangesetSdk {
37
44
} )
38
45
}
39
46
40
- async getTags ( ) : Promise < string [ ] > {
41
- core . info ( `Fetching tags from ${ this . url } /api/release/tags` )
47
+ async getProjectTags ( projectId : string ) : Promise < string [ ] > {
48
+ const url = new URL ( `${ this . url } /api/release/versions` )
49
+
50
+ url . searchParams . append ( 'projectId' , projectId )
51
+
52
+ core . info ( `Fetching tags from ${ url . toString ( ) } ` )
42
53
43
- const response = await fetch ( ` ${ this . url } /api/release/tags` , {
54
+ const response = await fetch ( url , {
44
55
method : 'GET' ,
45
56
headers : { 'Content-Type' : 'application/json' }
46
57
} )
47
58
48
- const json = ( await response . json ( ) ) as { tags : string [ ] }
59
+ const json = ( await response . json ( ) ) as GetProjectVersionsResponse
49
60
50
- json . tags . forEach ( tag => {
51
- core . info ( `Found tag: ${ tag } ` )
61
+ json . releases . forEach ( r => {
62
+ core . info ( `Found tag: ${ r . appName } ${ r . version } ` )
52
63
} )
53
64
54
- return json . tags
65
+ return json . releases . map ( r => ` ${ r . appName } @ ${ r . version } ` )
55
66
}
56
67
}
0 commit comments