Skip to content

Commit

Permalink
fix: error fetch more history for release events (#1403)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
jackton1 and actions-user authored Jul 24, 2023
1 parent 797a722 commit fc3c551
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
29 changes: 17 additions & 12 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions src/commitSha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,17 @@ export const getSHAForPushEvent = async (
core.info('Repository is shallow, fetching more history...')

if (isTag) {
const sourceBranch =
github.context.payload.base_ref.replace('refs/heads/', '') ||
github.context.payload.release?.target_commitish
let sourceBranch = ''

if (github.context.payload.base_ref) {
sourceBranch = github.context.payload.base_ref.replace(
'refs/heads/',
''
)
} else if (github.context.payload.release?.target_commitish) {
sourceBranch = github.context.payload.release?.target_commitish
}

await gitFetch({
cwd: workingDirectory,
args: [
Expand Down

0 comments on commit fc3c551

Please sign in to comment.