github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/cmd/scm/README.md (about)

     1  # Source Control Management Tool
     2  
     3  The SCM tool is designed for working with GitHub organizations from the command line.
     4  For example, you can list or remove all repositories and teams from your test organization, without having to interact manually with GitHub's web user interface.
     5  
     6  You must be an owner of the GitHub organization to be able to access its repositories and teams with SCM tool.
     7  
     8  ## Installation
     9  
    10  SCM tool must be compiled before it can be used.
    11  To compile the tool from the projects root folder:
    12  
    13  ```sh
    14  make scm
    15  ```
    16  
    17  Or from the `cmd/scm` folder:
    18  
    19  ```sh
    20  go install
    21  ```
    22  
    23  This will compile and install the tool in your `$GOPATH/bin` or `$GOBIN` folder; this path should also be added to your `$PATH` variable.
    24  
    25  ## GitHub Access Token
    26  
    27  To use SCM tool, you need to create a personal GitHub access token.
    28  This is done on GitHub's web page:
    29  
    30  1. Click your profile picture and select Settings.
    31  2. Select _Developer settings_ from the menu on the left.
    32  3. Select _Personal access tokens_ from the menu on the left.
    33  4. Select _Generate new token_.
    34  5. Name the token, e.g. `QuickFeed SCM Token`.
    35  6. Select _Scopes_ as needed.
    36     Currently I have enabled `admin:org, admin:org_hook, admin:repo_hook, delete_repo, repo, user`, but you may be able to get away with fewer access scopes.
    37     It depends on your needs.
    38  7. Copy the generated token string to the `GITHUB_ACCESS_TOKEN` environment variable.
    39     You may wish to add this token to your local `quickfeed-env.sh` script.
    40  
    41     ```sh
    42     export GITHUB_ACCESS_TOKEN="your token"
    43     ```
    44  
    45  ## Example Usage
    46  
    47  Assuming you are an owner of the `qf101` GitHub organization you can perform the several commands.
    48  To print information about all repositories under the `qf101` organization, you can run:
    49  
    50  ```sh
    51  scm --provider github get repo -all -namespace qf101
    52  ```
    53  
    54  To delete all teams under the `qf101` organization, you can run:
    55  
    56  ```sh
    57  scm delete team -all -namespace qf101
    58  ```
    59  
    60  For additional examples and instructions please see the comments in `cmd/scm/main.go`.