diff --git a/src/create-pull-request.ts b/src/create-pull-request.ts index 9076b7df..0ab4f8cc 100644 --- a/src/create-pull-request.ts +++ b/src/create-pull-request.ts @@ -211,6 +211,7 @@ export async function createPullRequest(inputs: Inputs): Promise { const stashed = await git.stashPush(['--include-untracked']) await git.checkout(inputs.branch) const pushSignedCommitsResult = await ghBranch.pushSignedCommits( + git, result.branchCommits, result.baseCommit, repoPath, diff --git a/src/github-helper.ts b/src/github-helper.ts index 82a9296a..0aeb4e9e 100644 --- a/src/github-helper.ts +++ b/src/github-helper.ts @@ -1,6 +1,6 @@ import * as core from '@actions/core' import {Inputs} from './create-pull-request' -import {Commit} from './git-command-manager' +import {Commit, GitCommandManager} from './git-command-manager' import {Octokit, OctokitOptions, throttleOptions} from './octokit-client' import pLimit from 'p-limit' import * as utils from './utils' @@ -220,6 +220,7 @@ export class GitHubHelper { } async pushSignedCommits( + git: GitCommandManager, branchCommits: Commit[], baseCommit: Commit, repoPath: string, @@ -233,6 +234,7 @@ export class GitHubHelper { } for (const commit of branchCommits) { headCommit = await this.createCommit( + git, commit, headCommit, repoPath, @@ -244,6 +246,7 @@ export class GitHubHelper { } private async createCommit( + git: GitCommandManager, commit: Commit, parentCommit: CommitResponse, repoPath: string, @@ -272,7 +275,7 @@ export class GitHubHelper { const {data: blob} = await blobCreationLimit(() => this.octokit.rest.git.createBlob({ ...repository, - content: utils.readFileBase64([repoPath, path]), + content: git.showFileAtRef(commit.sha, path), encoding: 'base64' }) )