Edits history of script submission #1623 for ' Set the customization template for an OIDC subject claim for an organization (github)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Github = {
      token: string;
    };
    /**
     * Set the customization template for an OIDC subject claim for an organization
     * Creates or updates the customization template for an OpenID Connect (OIDC) subject claim.
    You must authenticate using an access token with the `write:org` scope to use this endpoint.
    GitHub Apps must have the `admin:org` permission to use this endpoint.
     */
    export async function main(
      auth: Github,
      org: string,
      body: { include_claim_keys: string[]; [k: string]: unknown }
    ) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/actions/oidc/customization/sub`
      );
    
      const response = await fetch(url, {
        method: "PUT",
        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;
    };
    /**
     * Set the customization template for an OIDC subject claim for an organization
     * Creates or updates the customization template for an OpenID Connect (OIDC) subject claim.
    You must authenticate using an access token with the `write:org` scope to use this endpoint.
    GitHub Apps must have the `admin:org` permission to use this endpoint.
     */
    export async function main(
      auth: Github,
      org: string,
      body: { include_claim_keys: string[]; [k: string]: unknown }
    ) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/actions/oidc/customization/sub`
      );
    
      const response = await fetch(url, {
        method: "PUT",
        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