Skip to content

Commit b987d1a

Browse files
committed
fix: endpoint calling
1 parent cb70911 commit b987d1a

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

src/release.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ export class ReleaseTracker {
3737
}
3838

3939
async fetchReleases(tags: string[]) {
40+
const owner = this.config.repository.split('/')[0]
41+
const repoName = this.config.repository.split('/').slice(1).join('/')
42+
4043
const { results, errors } = await PromisePool.withConcurrency(2)
4144
.for(tags)
4245
.process(async tag => {
43-
const owner = this.config.repository.split('/')[0]
44-
const repoName = this.config.repository.split('/').slice(1).join('/')
45-
4646
core.debug(`Fetched release: ${tag}`)
4747

4848
const release = await this.octokit.rest.repos.getReleaseByTag({
@@ -99,7 +99,7 @@ export class ReleaseTracker {
9999

100100
async process() {
101101
const [stampedTags, githubTags] = await Promise.all([
102-
this.lcSdk.getTags(),
102+
this.lcSdk.getProjectTags(this.config.projectId),
103103
this.fetchAllTags()
104104
])
105105

src/sdk/linear-changeset.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ export type LinearChangesetSdkReleaseIssuesBody = InferOutput<
2121
typeof LinearChangesetSdkReleaseIssuesBody
2222
>
2323

24+
type GetProjectVersionsResponse = {
25+
releases: {
26+
appName: string
27+
version: string
28+
}[]
29+
}
30+
2431
export class LinearChangesetSdk {
2532
constructor(private readonly url: string) {}
2633

@@ -37,20 +44,24 @@ export class LinearChangesetSdk {
3744
})
3845
}
3946

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()}`)
4253

43-
const response = await fetch(`${this.url}/api/release/tags`, {
54+
const response = await fetch(url, {
4455
method: 'GET',
4556
headers: { 'Content-Type': 'application/json' }
4657
})
4758

48-
const json = (await response.json()) as { tags: string[] }
59+
const json = (await response.json()) as GetProjectVersionsResponse
4960

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}`)
5263
})
5364

54-
return json.tags
65+
return json.releases.map(r => `${r.appName}@${r.version}`)
5566
}
5667
}

0 commit comments

Comments
 (0)