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

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Github = {
      token: string;
    };
    /**
     * Create a registration token for an organization
     * Returns a token that you can pass to the `config` script. The token expires after one hour.
    
    You must authenticate using an access token with the `admin:org` scope to use this endpoint.
    
    #### Example using registration token
    
    Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
    
    ```
    ./config.sh --url https://github.com/octo-org --token TOKEN
    ```
     */
    export async function main(auth: Github, org: string) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/actions/runners/registration-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 registration token for an organization
     * Returns a token that you can pass to the `config` script. The token expires after one hour.
    
    You must authenticate using an access token with the `admin:org` scope to use this endpoint.
    
    #### Example using registration token
    
    Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
    
    ```
    ./config.sh --url https://github.com/octo-org --token TOKEN
    ```
     */
    export async function main(auth: Github, org: string) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/actions/runners/registration-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 registration token for an organization
     * Returns a token that you can pass to the `config` script. The token expires after one hour.
    
    You must authenticate using an access token with the `admin:org` scope to use this endpoint.
    
    #### Example using registration token
    
    Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
    
    ```
    ./config.sh --url https://github.com/octo-org --token TOKEN
    ```
     */
    export async function main(auth: Github, org: string) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/actions/runners/registration-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