Fix bugs found in E2E testing
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import * as core from '@actions/core';
|
||||
import { Context } from "@actions/github/lib/context";
|
||||
import { readFileSync, statSync } from 'fs';
|
||||
import { basename } from 'path';
|
||||
|
||||
export interface Inputs {
|
||||
readonly artifact: string
|
||||
readonly artifactName: string
|
||||
readonly artifactContentType: string
|
||||
readonly artifactContentLength: number
|
||||
readonly body: string
|
||||
@@ -12,6 +14,8 @@ export interface Inputs {
|
||||
readonly name: string
|
||||
readonly tag: string
|
||||
readonly token: string
|
||||
|
||||
readArtifact(): Buffer
|
||||
}
|
||||
|
||||
export class CoreInputs implements Inputs {
|
||||
@@ -25,6 +29,10 @@ export class CoreInputs implements Inputs {
|
||||
return core.getInput('artifact')
|
||||
}
|
||||
|
||||
get artifactName(): string {
|
||||
return basename(this.artifact)
|
||||
}
|
||||
|
||||
get artifactContentType(): string {
|
||||
const type = core.getInput('artifactContentType')
|
||||
if(type) {
|
||||
@@ -89,6 +97,10 @@ export class CoreInputs implements Inputs {
|
||||
return core.getInput('token', { required: true })
|
||||
}
|
||||
|
||||
readArtifact(): Buffer {
|
||||
return readFileSync(this.artifact)
|
||||
}
|
||||
|
||||
stringFromFile(path: string): string {
|
||||
return readFileSync(path, 'utf-8')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user