From 8f3c7d57e365f28ed8e50af48576436fd629ebcb Mon Sep 17 00:00:00 2001 From: "shigetoshi.komatsu" Date: Wed, 20 Dec 2023 10:36:05 +0900 Subject: [PATCH] change project v2 flag to project version number --- README.md | 2 +- src/github_projects_burndown_chart/main.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9b7e666..e944c65 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ This allows the `.gitignore` to exclude your `config.json` from being accidental | `chart_end_date` | (OPTIONAL) The last day to show on the burndown chart formatted as `YYYY-MM-DD`.

Used to change the end date of the chart without affecting the slope of the ideal burndown line (e.g. to show tasks that were completed after the official end of a sprint).

Example: `2021-10-24` | | `points_label` | (OPTIONAL) The prefix for issue labels containing the point value of the issue. Removing this prefix must leave just an integer. If set to `null`, the burndown chart will count open issues instead of points.

Example: `Points: ` (with the space) | | `calculators` | (OPTIONAL) A list of the calculator(s) to use to calculate the point burndown lines to show on the burndown chart. (DEFAULT: [`closed`])

_OPTIONS:_ `closed`, `assigned`, `created`, `taiga`

Example: [`taiga`, `closed`, `assigned`] | -| `v2` | (OPTIONAL) ProjectV2 or not. If set to `true`, the burndown chart is as Project V2. | +| `version` | (OPTIONAL) The version number of GitHub Projects to use the burndown chart. (DEFAULT: [`1`])

OPTIONS: `1`, `2`

Example: `2` | #### Organization Projects All settings are the same as for the [Repository Projects](#repository-projects), except `repo_owner` and `repo_name` are replaced with `organization_name` as shown below. diff --git a/src/github_projects_burndown_chart/main.py b/src/github_projects_burndown_chart/main.py index 5e4d576..9adc0d4 100644 --- a/src/github_projects_burndown_chart/main.py +++ b/src/github_projects_burndown_chart/main.py @@ -22,8 +22,8 @@ def parse_cli_args(): return parser.parse_args() -def download_project_data(project_type: str, v2: bool) -> Project: - if v2: +def download_project_data(project_type: str, project_version: int) -> Project: + if project_version == 2: return get_project_v2(project_type) if project_type == 'repository': @@ -57,7 +57,7 @@ def prepare_chart_data(stats: ProjectStats): if __name__ == '__main__': args = parse_cli_args() config.set_project(args.project_type, args.project_name) - project = download_project_data(args.project_type, config['settings']['v2']) + project = download_project_data(args.project_type, config['settings'].get('version', 1)) stats = ProjectStats(project, config.utc_sprint_start(), config.utc_chart_end() or config.utc_sprint_end()) # Generate the burndown chart -- 2.51.2