Edits history of script submission #23205 for ' Get Issue (github)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get Issue
     * Get an issue (or pull request) by number, including its assignees, labels and state.
     */
    export async function main(
      auth: RT.Github,
      owner: string,
      repo: string,
      issue_number: number
    ) {
      const response = await fetch(
        `https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}`,
        {
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/vnd.github+json",
            "X-GitHub-Api-Version": "2022-11-28",
          },
        }
      )
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 2 hours ago