mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-11 02:44:20 +00:00
Correct _release
undefined when creating a new release
This commit is contained in:
parent
330da87d2e
commit
b9834e5a65
3 changed files with 90 additions and 54 deletions
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --minify",
|
"build": "ncc build src/main.ts --minify",
|
||||||
|
"build-debug": "ncc build src/main.ts --v8-cache --source-map",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
||||||
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
||||||
|
|
|
@ -225,7 +225,20 @@ export const release = async (
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
}
|
}
|
||||||
let existingRelease = _release!;
|
if (_release === null || _release === undefined) {
|
||||||
|
return await createRelease(
|
||||||
|
tag,
|
||||||
|
config,
|
||||||
|
releaser,
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
discussion_category_name,
|
||||||
|
generate_release_notes,
|
||||||
|
maxRetries
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let existingRelease: Release = _release!;
|
||||||
console.log(
|
console.log(
|
||||||
`Found release ${existingRelease.name} (with id=${existingRelease.id})`
|
`Found release ${existingRelease.name} (with id=${existingRelease.id})`
|
||||||
);
|
);
|
||||||
|
@ -293,6 +306,29 @@ export const release = async (
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return await createRelease(
|
||||||
|
tag,
|
||||||
|
config,
|
||||||
|
releaser,
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
discussion_category_name,
|
||||||
|
generate_release_notes,
|
||||||
|
maxRetries
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function createRelease(
|
||||||
|
tag: string,
|
||||||
|
config: Config,
|
||||||
|
releaser: Releaser,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
discussion_category_name: string | undefined,
|
||||||
|
generate_release_notes: boolean | undefined,
|
||||||
|
maxRetries: number
|
||||||
|
) {
|
||||||
const tag_name = tag;
|
const tag_name = tag;
|
||||||
const name = config.input_name || tag;
|
const name = config.input_name || tag;
|
||||||
const body = releaseBody(config);
|
const body = releaseBody(config);
|
||||||
|
@ -347,4 +383,3 @@ export const release = async (
|
||||||
return release(config, releaser, maxRetries - 1);
|
return release(config, releaser, maxRetries - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue