Edits history of script submission #2235 for ' Update a check run (github)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Github = {
      token: string;
    };
    /**
     * Update a check run
     * **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.
    
    Updates a check run for a specific commit in a repository. Your GitHub App must have the `checks:write` permission to edit check runs.
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      check_run_id: string,
      body: (
        | { status?: "completed"; [k: string]: unknown }
        | { status?: "queued" | "in_progress"; [k: string]: unknown }
      ) & {
        actions?: {
          description: string;
          identifier: string;
          label: string;
          [k: string]: unknown;
        }[];
        completed_at?: string;
        conclusion?:
          | "action_required"
          | "cancelled"
          | "failure"
          | "neutral"
          | "success"
          | "skipped"
          | "stale"
          | "timed_out";
        details_url?: string;
        external_id?: string;
        name?: string;
        output?: {
          annotations?: {
            annotation_level: "notice" | "warning" | "failure";
            end_column?: number;
            end_line: number;
            message: string;
            path: string;
            raw_details?: string;
            start_column?: number;
            start_line: number;
            title?: string;
            [k: string]: unknown;
          }[];
          images?: {
            alt: string;
            caption?: string;
            image_url: string;
            [k: string]: unknown;
          }[];
          summary: string;
          text?: string;
          title?: string;
          [k: string]: unknown;
        };
        started_at?: string;
        status?: "queued" | "in_progress" | "completed";
        [k: string]: unknown;
      }
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/check-runs/${check_run_id}`
      );
    
      const response = await fetch(url, {
        method: "PATCH",
        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;
    };
    /**
     * Update a check run
     * **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.
    
    Updates a check run for a specific commit in a repository. Your GitHub App must have the `checks:write` permission to edit check runs.
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      check_run_id: string,
      body: (
        | { status?: "completed"; [k: string]: unknown }
        | { status?: "queued" | "in_progress"; [k: string]: unknown }
      ) & {
        actions?: {
          description: string;
          identifier: string;
          label: string;
          [k: string]: unknown;
        }[];
        completed_at?: string;
        conclusion?:
          | "action_required"
          | "cancelled"
          | "failure"
          | "neutral"
          | "success"
          | "skipped"
          | "stale"
          | "timed_out";
        details_url?: string;
        external_id?: string;
        name?: string;
        output?: {
          annotations?: {
            annotation_level: "notice" | "warning" | "failure";
            end_column?: number;
            end_line: number;
            message: string;
            path: string;
            raw_details?: string;
            start_column?: number;
            start_line: number;
            title?: string;
            [k: string]: unknown;
          }[];
          images?: {
            alt: string;
            caption?: string;
            image_url: string;
            [k: string]: unknown;
          }[];
          summary: string;
          text?: string;
          title?: string;
          [k: string]: unknown;
        };
        started_at?: string;
        status?: "queued" | "in_progress" | "completed";
        [k: string]: unknown;
      }
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/check-runs/${check_run_id}`
      );
    
      const response = await fetch(url, {
        method: "PATCH",
        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 872 days ago

  • nativets
    type Github = {
      token: string;
    };
    /**
     * Update a check run
     * **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.
    
    Updates a check run for a specific commit in a repository. Your GitHub App must have the `checks:write` permission to edit check runs.
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      check_run_id: string,
      body: (
        | { status?: "completed"; [k: string]: unknown }
        | { status?: "queued" | "in_progress"; [k: string]: unknown }
      ) & {
        actions?:
          | []
          | [
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              }
            ]
          | [
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              }
            ]
          | [
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              }
            ];
        completed_at?: string;
        conclusion?:
          | "action_required"
          | "cancelled"
          | "failure"
          | "neutral"
          | "success"
          | "skipped"
          | "stale"
          | "timed_out";
        details_url?: string;
        external_id?: string;
        name?: string;
        output?: {
          annotations?: {
            annotation_level: "notice" | "warning" | "failure";
            end_column?: number;
            end_line: number;
            message: string;
            path: string;
            raw_details?: string;
            start_column?: number;
            start_line: number;
            title?: string;
            [k: string]: unknown;
          }[];
          images?: {
            alt: string;
            caption?: string;
            image_url: string;
            [k: string]: unknown;
          }[];
          summary: string;
          text?: string;
          title?: string;
          [k: string]: unknown;
        };
        started_at?: string;
        status?: "queued" | "in_progress" | "completed";
        [k: string]: unknown;
      }
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/check-runs/${check_run_id}`
      );
    
      const response = await fetch(url, {
        method: "PATCH",
        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 921 days ago

  • nativets
    type Github = {
      token: string;
    };
    /**
     * Update a check run
     * **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.
    
    Updates a check run for a specific commit in a repository. Your GitHub App must have the `checks:write` permission to edit check runs.
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      check_run_id: string,
      body: (
        | { status?: "completed"; [k: string]: unknown }
        | { status?: "queued" | "in_progress"; [k: string]: unknown }
      ) & {
        actions?:
          | []
          | [
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
            ]
          | [
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
            ]
          | [
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
              {
                description: string;
                identifier: string;
                label: string;
                [k: string]: unknown;
              },
            ];
        completed_at?: string;
        conclusion?:
          | "action_required"
          | "cancelled"
          | "failure"
          | "neutral"
          | "success"
          | "skipped"
          | "stale"
          | "timed_out";
        details_url?: string;
        external_id?: string;
        name?: string;
        output?: {
          annotations?: {
            annotation_level: "notice" | "warning" | "failure";
            end_column?: number;
            end_line: number;
            message: string;
            path: string;
            raw_details?: string;
            start_column?: number;
            start_line: number;
            title?: string;
            [k: string]: unknown;
          }[];
          images?: {
            alt: string;
            caption?: string;
            image_url: string;
            [k: string]: unknown;
          }[];
          summary: string;
          text?: string;
          title?: string;
          [k: string]: unknown;
        };
        started_at?: string;
        status?: "queued" | "in_progress" | "completed";
        [k: string]: unknown;
      }
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/check-runs/${check_run_id}`
      );
    
      const response = await fetch(url, {
        method: "PATCH",
        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