UNPKG

artifact-metadata

Version:

NodeJS module to store Issues and Pull Requests metadata in GitHub Artifacts.

32 lines (24 loc) 766 B
import { DefaultArtifactClient } from '@actions/artifact'; export class Artifact { private client: DefaultArtifactClient; constructor() { this.client = new DefaultArtifactClient(); } async getByName(name: string) { const artifacts = await this.list(); console.log(`Artifacts: ${JSON.stringify(artifacts)}`); return artifacts.find(artifact => artifact.name === name); } async upload(name: string, files: string[]) { await this.client.uploadArtifact(name, files, process.cwd()); } async list() { return (await this.client.listArtifacts()).artifacts; } async download(id: number) { return await this.client.downloadArtifact(id); } async remove(name: string) { await this.client.deleteArtifact(name); } }