Skip to content

Commit

Permalink
fetch manifest data
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Feb 6, 2024
1 parent fbc5621 commit c008ff1
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 21 deletions.
19 changes: 18 additions & 1 deletion deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 19 additions & 19 deletions dist/bundle.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/fetch_manifest_data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ManifestData } from './interface/manifest_data.ts';

export function fetchManifestData(url : string) : Promise<ManifestData> {
return fetch(url).then(async (response) => {
try {
return await response.json() as Promise<ManifestData>
} catch (error) {
throw new Error(error)
}
})
}
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import * as actionsCore from '@actions/core';
import { fetchManifestData } from './fetch_manifest_data.ts';

const inputManifestURL = actionsCore.getInput('manifest-url');

(async () => {
console.log((await fetchManifestData(inputManifestURL)).latest);
})()

console.log(actionsCore.getInput('manifest-url'));
9 changes: 9 additions & 0 deletions src/interface/manifest_data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { VersionEntry } from './version_entry.ts';

export interface ManifestData {
latest : {
release : string,
snapshot : string
},
versions : VersionEntry[]
}
11 changes: 11 additions & 0 deletions src/interface/version_entry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { VersionType } from './version_type.ts';

export interface VersionEntry {
id : string,
type : VersionType,
url : string,
time : string,
releaseTime : string,
sha1 : string,
complianceLevel : number
}
1 change: 1 addition & 0 deletions src/interface/version_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type VersionType = 'latest' | 'snapshot'

0 comments on commit c008ff1

Please sign in to comment.