diff --git a/.github/workflows/contributor_report.yaml b/.github/workflows/contributor_report.yaml index 8c71042..1385546 100644 --- a/.github/workflows/contributor_report.yaml +++ b/.github/workflows/contributor_report.yaml @@ -27,7 +27,7 @@ jobs: echo "END_DATE=$end_date" >> "$GITHUB_ENV" - name: Run contributor action - uses: github/contributors@9e9ce8e51fe186c4d699ebb3d35c1f1fd755a357 # v1.5.7 + uses: github/contributors@6949781e2a2575cba21a80325c9dd6014f5c898b # v1.5.8 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} START_DATE: ${{ env.START_DATE }} diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 94418b6..9a7a3df 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -30,7 +30,7 @@ jobs: run: | pip install -r requirements.txt -r requirements-test.txt - name: Lint Code Base - uses: super-linter/super-linter@4e8a7c2bf106c4c766c816b35ec612638dc9b6b2 # v7.3.0 + uses: super-linter/super-linter@12150456a73e248bdc94d0794898f94e23127c88 # v7.4.0 env: DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 5074dcd..db4bd3c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -42,6 +42,6 @@ jobs: path: results.sarif retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.24.9 + uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.24.9 with: sarif_file: results.sarif diff --git a/Dockerfile b/Dockerfile index 51d286b..dd3fc58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ #checkov:skip=CKV_DOCKER_2 #checkov:skip=CKV_DOCKER_3 -FROM python:3.13-slim@sha256:21e39cf1815802d4c6f89a0d3a166cc67ce58f95b6d1639e68a394c99310d2e5 +FROM python:3.13-slim@sha256:56a11364ffe0fee3bd60af6d6d5209eba8a99c2c16dc4c7c5861dc06261503cc LABEL com.github.actions.name="issue-metrics" \ com.github.actions.description="Gather metrics on issues/prs/discussions such as time to first response, count of issues opened, closed, etc." \ com.github.actions.icon="check-square" \ diff --git a/issue_metrics.py b/issue_metrics.py index a1b3f11..ab9cb91 100644 --- a/issue_metrics.py +++ b/issue_metrics.py @@ -281,6 +281,7 @@ def main(): # pragma: no cover search_query=search_query, hide_label_metrics=False, hide_items_closed_count=False, + enable_mentor_count=enable_mentor_count, non_mentioning_links=False, report_title=report_title, output_file=output_file, @@ -307,6 +308,7 @@ def main(): # pragma: no cover search_query=search_query, hide_label_metrics=False, hide_items_closed_count=False, + enable_mentor_count=enable_mentor_count, non_mentioning_links=False, report_title=report_title, output_file=output_file, @@ -370,6 +372,7 @@ def main(): # pragma: no cover search_query=search_query, hide_label_metrics=hide_label_metrics, hide_items_closed_count=hide_items_closed_count, + enable_mentor_count=enable_mentor_count, non_mentioning_links=non_mentioning_links, report_title=report_title, output_file=output_file, diff --git a/labels.py b/labels.py index 81b9b4b..b9502b4 100644 --- a/labels.py +++ b/labels.py @@ -56,7 +56,7 @@ def get_label_metrics(issue: github3.issues.Issue, labels: List[str]) -> dict: # Calculate the time to add or subtract to the time spent in label based on the label events for event in label_events: - # Skip labeling events that have occured past issue close time + # Skip labeling events that have occurred past issue close time if issue.closed_at is not None and ( event.created_at >= datetime.fromisoformat(issue.closed_at) ): diff --git a/markdown_writer.py b/markdown_writer.py index e506a4f..ed0d05d 100644 --- a/markdown_writer.py +++ b/markdown_writer.py @@ -100,6 +100,7 @@ def write_to_markdown( search_query=None, hide_label_metrics=False, hide_items_closed_count=False, + enable_mentor_count=False, non_mentioning_links=False, report_title="", output_file="", @@ -168,6 +169,7 @@ def write_to_markdown( file, hide_label_metrics, hide_items_closed_count, + enable_mentor_count, ) # Write second table with individual issue/pr/discussion metrics @@ -243,6 +245,7 @@ def write_overall_metrics_tables( file, hide_label_metrics, hide_items_closed_count=False, + enable_mentor_count=False, ): """Write the overall metrics tables to the markdown file.""" if any( @@ -316,5 +319,6 @@ def write_overall_metrics_tables( file.write(f"| Number of items that remain open | {num_issues_opened} |\n") if not hide_items_closed_count: file.write(f"| Number of items closed | {num_issues_closed} |\n") - file.write(f"| Number of most active mentors | {num_mentor_count} |\n") + if enable_mentor_count: + file.write(f"| Number of most active mentors | {num_mentor_count} |\n") file.write(f"| Total number of items created | {len(issues_with_metrics)} |\n\n") diff --git a/requirements-test.txt b/requirements-test.txt index b629065..3984740 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -5,5 +5,5 @@ mypy-extensions==1.1.0 pylint==3.3.7 pytest==8.3.5 pytest-cov==6.1.1 -types-pytz==2025.2.0.20250326 -types-requests==2.32.0.20250328 +types-pytz==2025.2.0.20250516 +types-requests==2.32.0.20250515 diff --git a/test_markdown_writer.py b/test_markdown_writer.py index 3927106..e8f5b08 100644 --- a/test_markdown_writer.py +++ b/test_markdown_writer.py @@ -129,7 +129,6 @@ def test_write_to_markdown(self): "| --- | ---: |\n" "| Number of items that remain open | 2 |\n" "| Number of items closed | 1 |\n" - "| Number of most active mentors | 5 |\n" "| Total number of items created | 2 |\n\n" "| Title | URL | Author | Time to first response | Time to close |" " Time to answer | Time in draft | Time spent in bug | Created At |\n" @@ -240,7 +239,6 @@ def test_write_to_markdown_with_vertical_bar_in_title(self): "| --- | ---: |\n" "| Number of items that remain open | 2 |\n" "| Number of items closed | 1 |\n" - "| Number of most active mentors | 5 |\n" "| Total number of items created | 2 |\n\n" "| Title | URL | Author | Time to first response | Time to close |" " Time to answer | Time in draft | Time spent in bug | Created At |\n" @@ -369,6 +367,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self): search_query="repo:user/repo is:issue", hide_label_metrics=True, hide_items_closed_count=True, + enable_mentor_count=True, non_mentioning_links=True, report_title="Issue Metrics", output_file="issue_metrics.md",