Edits history of script submission #1620 for ' Generate release notes content for a release (github)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Github = {
      token: string;
    };
    /**
     * Generate release notes content for a release
     * Generate a name and body describing a [release](https://docs.github.com/rest/reference/repos#releases). The body content will be markdown formatted and contain information like the changes since last release and users who contributed. The generated release notes are not saved anywhere. They are intended to be generated and used when creating a new release.
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      body: {
        configuration_file_path?: string;
        previous_tag_name?: string;
        tag_name: string;
        target_commitish?: string;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/releases/generate-notes`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 367 days ago

  • nativets
    type Github = {
      token: string;
    };
    /**
     * Generate release notes content for a release
     * Generate a name and body describing a [release](https://docs.github.com/rest/reference/repos#releases). The body content will be markdown formatted and contain information like the changes since last release and users who contributed. The generated release notes are not saved anywhere. They are intended to be generated and used when creating a new release.
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      body: {
        configuration_file_path?: string;
        previous_tag_name?: string;
        tag_name: string;
        target_commitish?: string;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/releases/generate-notes`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 927 days ago