Edits history of script submission #2014 for ' Create a remove token for an organization (github)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Github = {
      token: string;
    };
    /**
     * Create a remove token for an organization
     * Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour.
    
    You must authenticate using an access token with the `admin:org` scope to use this endpoint.
    
    #### Example using remove token
    
    To remove your self-hosted runner from an organization, replace `TOKEN` with the remove token provided by this
    endpoint.
    
    ```
    ./config.sh remove --token TOKEN
    ```
     */
    export async function main(auth: Github, org: string) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/actions/runners/remove-token`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      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;
    };
    /**
     * Create a remove token for an organization
     * Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour.
    
    You must authenticate using an access token with the `admin:org` scope to use this endpoint.
    
    #### Example using remove token
    
    To remove your self-hosted runner from an organization, replace `TOKEN` with the remove token provided by this
    endpoint.
    
    ```
    ./config.sh remove --token TOKEN
    ```
     */
    export async function main(auth: Github, org: string) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/actions/runners/remove-token`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      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;
    };
    /**
     * Create a remove token for an organization
     * Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour.
    
    You must authenticate using an access token with the `admin:org` scope to use this endpoint.
    
    #### Example using remove token
    
    To remove your self-hosted runner from an organization, replace `TOKEN` with the remove token provided by this
    endpoint.
    
    ```
    ./config.sh remove --token TOKEN
    ```
     */
    export async function main(auth: Github, org: string) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/actions/runners/remove-auth.token`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 927 days ago