MCPcopy
hub / github.com/softprops/action-gh-release / createRelease

Function createRelease

src/github.ts:886–970  ·  view source on GitHub ↗
(
  tag: string,
  config: Config,
  releaser: Releaser,
  owner: string,
  repo: string,
  discussion_category_name: string | undefined,
  generate_release_notes: boolean | undefined,
  maxRetries: number,
  previous_tag_name: string | undefined,
)

Source from the content-addressed store, hash-verified

884}
885
886async function createRelease(
887 tag: string,
888 config: Config,
889 releaser: Releaser,
890 owner: string,
891 repo: string,
892 discussion_category_name: string | undefined,
893 generate_release_notes: boolean | undefined,
894 maxRetries: number,
895 previous_tag_name: string | undefined,
896): Promise<ReleaseResult> {
897 const tag_name = tag;
898 const name = config.input_name || tag;
899 const body = releaseBody(config);
900 const prerelease = config.input_prerelease;
901 const draft = prerelease === true ? config.input_draft === true : true;
902 const target_commitish = config.input_target_commitish;
903 const make_latest = config.input_make_latest;
904 let commitMessage: string = '';
905 if (target_commitish) {
906 commitMessage = ` using commit "${target_commitish}"`;
907 }
908 console.log(`👩‍🏭 Creating new GitHub release for tag ${tag_name}${commitMessage}...`);
909 try {
910 const createdRelease = await releaser.createRelease({
911 owner,
912 repo,
913 tag_name,
914 name,
915 body,
916 draft,
917 prerelease,
918 target_commitish,
919 discussion_category_name,
920 generate_release_notes,
921 make_latest,
922 previous_tag_name,
923 });
924 const canonicalRelease = await canonicalizeCreatedRelease(
925 releaser,
926 owner,
927 repo,
928 tag_name,
929 createdRelease.data,
930 maxRetries,
931 );
932 return {
933 release: canonicalRelease,
934 created: canonicalRelease.id === createdRelease.data.id,
935 };
936 } catch (error) {
937 // presume a race with competing matrix runs
938 console.log(`⚠️ GitHub release failed with status: ${error.status}`);
939 console.log(`${JSON.stringify(error.response.data)}`);
940
941 switch (error.status) {
942 case 403:
943 console.log(

Callers 1

releaseFunction · 0.85

Calls 4

releaseBodyFunction · 0.90
releaseFunction · 0.85
createReleaseMethod · 0.65

Tested by

no test coverage detected