#guardian #cli-tool #cli #github

app self-assessment

A CLI tool that generates a list of pull requests raised and reviewed in the Guardian's GitHub organisation, as well as an optional summary of the user's Trello boards and cards

9 releases (stable)

2.0.0 Nov 12, 2022
1.1.2 Aug 3, 2022
1.1.1 Mar 28, 2022
1.0.0 Feb 23, 2022
0.1.1 Feb 16, 2022

#1431 in Command line utilities

Download history 15/week @ 2023-10-30 3/week @ 2023-11-13 11/week @ 2023-11-20 29/week @ 2023-11-27 18/week @ 2023-12-04 10/week @ 2023-12-11 18/week @ 2023-12-25 10/week @ 2024-01-01 8/week @ 2024-01-22 18/week @ 2024-01-29 1/week @ 2024-02-05 46/week @ 2024-02-12

73 downloads per month

MIT license

43KB
987 lines

Guardian Self Assessment CLI tool

What?

self-assessment is a tool that generates a list of PRs authored and reviewed by you, as well as an optional report of Trello boards and cards you are assigned to.

Why?

Assessing oneself is hard - this tool aims to make the process a little bit easier.
It is not meant to be the be-all and end-all of the self-assessment journey. Use it as a starting point to remember your contributions to the Guardian.

How?

  1. You need Rust to install self-assessment. Running the following command will install the Rust toolchain on your machine. If Rust is already installed, skip this step.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Run cargo install self-assessment to install or update the CLI tool to the latest version.

  2. You can now start using the CLI tool! But first, you need to generate a GitHub personal access token 👉 here 👈
    This is required for the tool to access your pull requests in private repositories within the Guardian organisation.
    Set your preferred expiration date and make sure you grant the repo scopes (avoid "No expiration" for security reasons). Finally, click "Generate token".
    NB: You will need to re-authenticate once the token expires.

image
  1. Set the access token by running the following command (replace <TOKEN> with the generated token):
self-assessment auth <TOKEN>
  1. You can now run the CLI tool using the following syntax:
self-assessment generate-report --from <YYYY-MM-DD> --to <YYYY-MM-DD>

Both the --from and --to flags are optional. If you want to include Trello boards and cards in your report, read the Trello report section.
If no flags are specified (i.e. if you just execute self-assessment generate-report), you will get a list of all PRs with no time constraints. This is not recommended, as it is likely to incur GitHub's secondary rate limit (particularly if you've been at the Guardian a long time and are a prolific contributor). Omitting one of the two flags also works (e.g self-assessment generate-report --from 2021-10-01).

If all goes well, you should see an automatically generated HTML page containing useful information about PRs authored and reviewed by you.

image image

Trello report

In order to display the Trello cards your name is assigned to, you need to configure the CLI with a Trello API key and a token.

Step 1

You can obtain a key by logging into Trello and then visiting https://trello.com/app-key (please note that this page will throw an error if you are not logged in). Make a note of this key.

Step 2

From the same page, click the link to generate a server token.

image

You will be taken to a page to generate a sever token, which is set to never expire by default (authorize?expiration=never). It is strongly recommended that you change the query parameter in the URL to authorize?expiration=30days for security reasons.

Once you have obtained both your API key and your server token, run the following command from the terminal:

self-assessment trello-auth <API_KEY> <TOKEN>

Running self-assessment generate-report from the terminal will now generate a report including Trello cards assigned to you, as well as your authored and reviewed GitHub pull requests. The --from <YYYY-MM-DD> and --to <YYYY--MM-DD> flags are fully supported.

CLI information

self-assessment 2.0.0
A CLI tool that generates a list of pull requests raised and reviewed in the Guardian's GitHub
organisation, as well as an optional summary of the user's Trello boards and cards.

USAGE:
    self-assessment <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    auth               Authenticate to Github. This is needed for the CLI tool to access the
                       Guardian's private repositories to which the user has access. You can get
                       a personal access token at <https://github.com/settings/tokens/new>
    generate-report    Generate a report containing a list of PRs authored and reviewed by you,
                       as well as an optional report of Trello boards and cards you are assigned
                       to. For more information, run self-assessment generate-report --help
    help               Print this message or the help of the given subcommand(s)
    trello-auth        Authenticate to Trello. An API key and a server token are required. For
                       more information, run self-assessment trello-auth --help

Dependencies

~26–42MB
~796K SLoC