Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#31 Clean up in preparation for release #37

Merged
merged 20 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
env:
MAIN_PYTHON_VERSION: "3.12" # same as Ubuntu 24 LTS

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: "^\\.idea"

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.0
hooks:
- id: ruff-format
- id: ruff
Expand Down
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Repository permissions:

- Issues: read-only
- Pull requests: read-only
- Metadata: read-ony (mandatory and enabled automatically)
- Metadata: read-only (mandatory and enabled automatically)

Organization permissions:

Expand All @@ -56,14 +56,12 @@ Many coding guidelines are automatically enforced (and some even fixed automatic
poetry run pre-commit run --all-files
```

## Release cheatsheet
## Release cheat-sheet

This section only relevant for developers with access to the PyPI project.

To add a new release, first update the `pyproject.toml`:

.. code-block:: toml

```toml
[tool.poetry]
version = "1.x.x"
Expand Down
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@

# check_done

Check_done is a command line tool to check that GitHub issues and pull requests in a project board with a status of "Done" are really done.
A command-line tool that validates the completeness of GitHub project items (issue or pull request) in your specified project status that represents done project items.

For each issue or pull request in the "Done" column of the project board, it checks that:
Current checks are:

- It is closed.
- It has an assignee.
- It is assigned to a milestone.
- All tasks are completed (list with checkboxes in the description).
- Project item is closed.
- Project item has an assignee.
- Project item has a set milestone.
- Project item has all tasks completed (list with checkboxes in the description).
- Pull request has a closing issue reference.

For pull requests, it additionally checks if they reference an issue.

This ensures a consistent quality on done issues and pull requests, and helps to notice if they were accidentally deemed to be done too early.
This ensures a consistent quality on done project items, and helps to notice if they were accidentally deemed to be done too early.

## Installation

In order to gain access to your project board, issues, and pull requests, check_done needs to be authorized. The exact way to do that depends on whether your project belongs to a single user or a GitHub organization.
In order to gain access to your project board, issues, and pull requests, check_done needs to be authorized. The exact way to do that depends on whether your project belongs to a GitHub user or organization.

For user projects, [create a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with the permission: `read:project`.

Expand Down Expand Up @@ -70,16 +69,16 @@ In order to avoid having to commit tokens and keys into your repository, you can
personal_access_token: ${MY_PERSONAL_ACCESS_TOKEN_ENVVAR}
```

### Changing the board status column to check
### Changing the project status name to check

By default, check_done checks all issues and pull requests in the column rightmost/last column of the project board. If you left the default names when creating the GitHub project board, this would be the `"✅ Done"` column.
By default, check_done checks all issues and pull requests in the last selectable project status. If you left the default names when creating the GitHub project board, this would be the `"✅ Done"` project status.

If you want to check a different column, you can specify its name with this option. For example:
If you want to check a different project status, you can specify a partial or exact matching name with this option. For example:

```yaml
project_status_name_to_check = "Done"
```

The name takes the first column that partially matches the case sensitivity. For example, `"Done"` will also match `"✅ Done"`, but not `"done"`.
The name takes the first project status that partially matches the case sensitivity. For example, `"Done"` will also match `"✅ Done"`, but not `"done"`.

If no column matches, the resulting error messages will tell you the exact names of all available columns.
If no project status matches, the resulting error messages will show you the exact name of the available project status selections.
5 changes: 4 additions & 1 deletion check_done/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

logger = logging.getLogger(__name__)

_HELP_DESCRIPTION = "Checks that finished issues and pull requests in a GitHub project board column are really done."
_HELP_DESCRIPTION = (
"A command-line tool that validates the completeness of GitHub project items "
"(issue or pull request) in your specified project status that represents done project items."
)


def check_done_command(arguments=None) -> int:
Expand Down
12 changes: 6 additions & 6 deletions check_done/done_project_items_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def done_project_items_info(configuration_info: ConfigurationInfo) -> list[Proje
)

project_status_name_to_check = configuration_info.project_status_name_to_check
project_status_option_id = matching_project_state_option_id(
project_status_option_id = matching_project_status_option_id(
project_single_select_field_infos,
project_status_name_to_check,
project_number,
Expand All @@ -74,7 +74,7 @@ def matching_project_id(project_infos: list[ProjectV2Node], project_number: int,
) from None


def matching_project_state_option_id(
def matching_project_status_option_id(
project_single_select_field_infos: list[ProjectV2SingleSelectFieldNode],
project_status_name_to_check: str | None,
project_number: int,
Expand Down Expand Up @@ -117,14 +117,14 @@ def matching_project_state_option_id(

def filtered_project_item_infos_by_done_status(
project_item_infos: list[ProjectV2ItemNode],
project_state_option_id: str,
project_status_option_id: str,
) -> list[ProjectItemInfo]:
result = []
for project_item_info in project_item_infos:
has_project_state_option = (
has_project_status_option = (
project_item_info.field_value_by_name is not None
and project_item_info.field_value_by_name.option_id == project_state_option_id
and project_item_info.field_value_by_name.option_id == project_status_option_id
)
if has_project_state_option:
if has_project_status_option:
result.append(project_item_info.content)
return result
Loading
Loading