Skip to content

Commit

Permalink
Ignore error when some tag on remote was updated
Browse files Browse the repository at this point in the history
  • Loading branch information
dorny committed Mar 29, 2021
1 parent ad1ae68 commit 208adf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,9 @@ async function getChangesSinceMergeBase(base, ref, initialFetchDepth) {
if (baseRef === undefined) {
baseRef = await getFullRef(base);
if (baseRef === undefined) {
await exec_1.default('git', ['fetch', '--tags', `--depth=1`, 'origin', base, ref]);
await exec_1.default('git', ['fetch', '--tags', '--depth=1', 'origin', base, ref], {
ignoreReturnCode: true // returns exit code 1 if tags on remote were updated - we can safely ignore it
});
baseRef = await getFullRef(base);
if (baseRef === undefined) {
throw new Error(`Could not determine what is ${base} - fetch works but it's not a branch or tag`);
Expand Down
4 changes: 3 additions & 1 deletion src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export async function getChangesSinceMergeBase(base: string, ref: string, initia
if (baseRef === undefined) {
baseRef = await getFullRef(base)
if (baseRef === undefined) {
await exec('git', ['fetch', '--tags', `--depth=1`, 'origin', base, ref])
await exec('git', ['fetch', '--tags', '--depth=1', 'origin', base, ref], {
ignoreReturnCode: true // returns exit code 1 if tags on remote were updated - we can safely ignore it
})
baseRef = await getFullRef(base)
if (baseRef === undefined) {
throw new Error(`Could not determine what is ${base} - fetch works but it's not a branch or tag`)
Expand Down

0 comments on commit 208adf4

Please sign in to comment.