fix filepath when using path input
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as fs from 'fs'
|
||||
import {graphql} from '@octokit/graphql'
|
||||
import type {
|
||||
Repository,
|
||||
@ -327,7 +326,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||
core.debug(`Reading contents of file: '${file}'`)
|
||||
fileChanges.additions!.push({
|
||||
path: file,
|
||||
contents: fs.readFileSync(file).toString('base64')
|
||||
contents: utils.readFileBase64([repoPath, file])
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,10 @@ export function readFile(path: string): string {
|
||||
return fs.readFileSync(path, 'utf-8')
|
||||
}
|
||||
|
||||
export function readFileBase64(pathParts: string[]): string {
|
||||
return fs.readFileSync(path.resolve(...pathParts)).toString('base64')
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
function hasErrorCode(error: any): error is {code: string} {
|
||||
return typeof (error && error.code) === 'string'
|
||||
|
Reference in New Issue
Block a user