Skip to content

fix: compare sponsor_info as bool instead of string#446

Open
jmeridth wants to merge 1 commit intomainfrom
fix/sponsor-info-bool-comparison
Open

fix: compare sponsor_info as bool instead of string#446
jmeridth wants to merge 1 commit intomainfrom
fix/sponsor-info-bool-comparison

Conversation

@jmeridth
Copy link
Copy Markdown
Collaborator

@jmeridth jmeridth commented Apr 1, 2026

Pull Request

Proposed Changes

Relates to github-community-projects/cleanowners#373

What

Changed the sponsor_info gate in contributors.py from a string comparison (== "true") to a truthy check, and updated the test mock to return a bool to match what get_bool_env_var actually returns.

Why

get_bool_env_var returns a Python bool, but the comparison checked for the string "true". Since True == "true" is always False in Python, sponsor information was never fetched regardless of the SPONSOR_INFO env var setting. This caused all contributors to show as "not sponsorable" in generated reports.

Notes

  • markdown.py already has _is_truthy() that handles both types, so the rendering side was not affected — only the data fetch was skipped.
  • json_writer.py passes sponsor_info through without comparison, so it's also unaffected.

Testing

  • make test — all 64 tests pass, 99% coverage
  • Updated test_main_fetches_sponsor_info_when_enabled to mock sponsor_info as True (bool) instead of "true" (string), matching real get_bool_env_var return type
  • Verified via GraphQL that hasSponsorsListing returns true for an affected user (jmeridth) — confirming the issue is in the comparison, not the API

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • run make lint and fix any issues that you have introduced
  • run make test and ensure you have test coverage for the lines you are introducing

Relates to github-community-projects/cleanowners#373

## What

Changed the sponsor_info gate in contributors.py from a string comparison
(`== "true"`) to a truthy check, and updated the test mock to return a
bool to match what get_bool_env_var actually returns.

## Why

get_bool_env_var returns a Python bool, but the comparison checked for
the string "true". Since `True == "true"` is always False, sponsor
information was never fetched regardless of the SPONSOR_INFO env var
setting.

## Notes

- markdown.py already has `_is_truthy()` that handles both types, so the
  rendering side was not affected — only the data fetch was skipped.
- json_writer.py passes sponsor_info through without comparison, so it's
  also unaffected.

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth added the Mark Ready When Ready Automatically mark draft PR ready when checks pass label Apr 1, 2026
@jmeridth jmeridth self-assigned this Apr 1, 2026
@github-actions github-actions bot added the fix label Apr 1, 2026
@jmeridth jmeridth added Mark Ready When Ready Automatically mark draft PR ready when checks pass release and removed Mark Ready When Ready Automatically mark draft PR ready when checks pass labels Apr 1, 2026
@github-actions github-actions bot marked this pull request as ready for review April 1, 2026 05:14
@github-actions github-actions bot requested a review from zkoppert as a code owner April 1, 2026 05:14
@github-actions github-actions bot removed the Mark Ready When Ready Automatically mark draft PR ready when checks pass label Apr 1, 2026
Copy link
Copy Markdown
Collaborator

@zkoppert zkoppert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants