Updated the header documentation for the AI feedback collection script.

This commit is contained in:
Jimmy Royer 2024-12-27 16:10:54 -05:00
parent cc780e04dd
commit c68b740c29

View file

@ -1,24 +1,37 @@
/** /**
* This script fetches comments from specified GitHub pull requests and exports them to a CSV file. * This script fetches comments from specified GitHub pull requests and exports them to a CSV file.
*
* It uses the GitHub API to retrieve the comments and filters them based on the provided author (if specified). * It uses the GitHub API to retrieve the comments and filters them based on the provided author (if specified).
* The resulting CSV file contains the pull request number, author, comment, and a link to the comment. * The resulting CSV file contains the date, AI feedback, pull request number, author, comment, and a link to
* the comment.
* *
* Usage: * Usage:
* npx ts-node exportComments.ts --token <your_github_token> --owner <repo_owner> --repo <repo_name> --prs <pr_numbers> [--author <author_name>] * npx ts-node exportComments.ts --token <your_github_token> --owner <repo_owner> --repo <repo_name> --prs <pr_numbers> [--author <author_name>]
* *
* Options: * Options:
* --token, -t GitHub personal access token (can also be set via the GITHUB_TOKEN environment variable) * --owner, -o Repository owner (required)
* It is recommended to use the environment variable to avoid exposing sensitive information. * --repo, -r Repository name (required)
* --owner, -o Repository owner * --author, -a Author of the comments to filter with (optional -- likely the AI bot author name)
* --repo, -r Repository name * --since, -s Filter comments since the given date (YYYY-MM-DD) (required)
* --prs, -p Comma-separated list of pull request numbers * --until, -u Filter comments until the given date (YYYY-MM-DD) (optional, defaults to now)
* --author, -a Author of the comments to filter with (optional) * --token, -t GitHub personal access token (can also be set via the GITHUB_TOKEN environment variable or `.env` file)
* It is recommended to use the environment variable to avoid exposing sensitive information.
* *
* Example: * Example:
* npx ts-node exportComments.ts --owner cds-snc --repo cds-ai-codereviewer --prs 6,7,8 --author github-actions[bot] * npx ts-node exportComments.ts --owner cds-snc --repo cds-ai-codereviewer --prs 6,7,8 --author github-actions[bot]
*
* npx ts-node src/exportComments.ts --owner cds-snc --repo notification-terraform --since 2024-12-01 --author 'github-actions[bot]' --until 2024-12-31
* *
* Environment Variable: * Environment Variable:
* GITHUB_TOKEN GitHub personal access token (recommended to use this instead of --token argument) * GITHUB_TOKEN GitHub personal access token (recommended to use this instead of --token argument)
*
* The GITHUB_TOKEN can be configured using a .env file at the root of the project:
*
* Example .env file:
*
* ```txt
* GITHUB_TOKEN=your_actual_token_here
* ```
*/ */
import axios from "axios"; import axios from "axios";