Skip to content

Commit

Permalink
Rename yevis config file -> yevis metadata file
Browse files Browse the repository at this point in the history
  • Loading branch information
suecharo committed May 2, 2022
1 parent cb6c2b4 commit 78b83d5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/api/trs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ export const getToolVersion = async (
return await res.json()
}

export const getGhTrsConfig = async (
export const getYevisMetadata = async (
id: string,
version: string
): Promise<Config> => {
const res = await fetch(
`${trsEndpoint().replace(
/\/$/,
''
)}/tools/${id}/versions/${version}/gh-trs-config.json`,
)}/tools/${id}/versions/${version}/yevis-metadata.json`,
{
method: 'GET',
}
Expand All @@ -119,7 +119,7 @@ export const getGhTrsConfig = async (
`Failed to get ${trsEndpoint().replace(
/\/$/,
''
)}/tools/${id}/versions/${version}/gh-trs-config.json with error: ${
)}/tools/${id}/versions/${version}/yevis-metadata.json with error: ${
res.status
} ${res.statusText}`
)
Expand All @@ -129,12 +129,12 @@ export const getGhTrsConfig = async (

// params: [id, version][]
// return: { `${id}_${version}`: Config }
export const getGhTrsConfigs = async (
export const getYevisMetadataFiles = async (
idVersions: [string, string][]
): Promise<Record<string, Config>> => {
const configs: Record<string, Config> = {} // key: ${id}_${version}
const results = await Promise.all(
idVersions.map(([id, version]) => getGhTrsConfig(id, version))
idVersions.map(([id, version]) => getYevisMetadata(id, version))
)
results.forEach((config) => {
configs[`${config.id}_${config.version}`] = config
Expand All @@ -149,7 +149,7 @@ export const getLastModifiedDate = async (
): Promise<string> => {
const commits = await request('GET /repos/{owner}/{repo}/commits', {
owner: wfRepo().split('/')[0],
path: `tools/${id}/versions/${version}/gh-trs-config.json`,
path: `tools/${id}/versions/${version}/yevis-metadata.json`,
per_page: 1,
repo: wfRepo().split('/')[1],
sha: wfRepoGhPagesBranch(),
Expand Down Expand Up @@ -199,7 +199,7 @@ export const getPublishedWorkflows = async (): Promise<PublishedWorkflows> => {
(toolVersion) => [toolVersion.id, extractVersionStr(toolVersion)]
)
const [configs, modifiedDate] = await Promise.all([
getGhTrsConfigs(latestIdVersions),
getYevisMetadataFiles(latestIdVersions),
getLastModifiedDates(latestIdVersions),
])
const publishedWorkflows: PublishedWorkflows = {}
Expand Down Expand Up @@ -331,7 +331,7 @@ export const getPublishedWorkflow = async (
): Promise<PublishedWorkflow> => {
const [toolVersion, config, modifiedDate] = await Promise.all([
getToolVersion(id, version),
getGhTrsConfig(id, version),
getYevisMetadata(id, version),
getLastModifiedDate(id, version),
])
return {
Expand Down

0 comments on commit 78b83d5

Please sign in to comment.