fix: convert gh_app_id to string before login_as_app_installation call#121
Merged
fix: convert gh_app_id to string before login_as_app_installation call#121
Conversation
### What Wrapped gh_app_id with str() in the login_as_app_installation call in auth.py, added targeted tests for integer app_id inputs, and tightened existing test assertions to verify exact call arguments. Also added .claude local files to .gitignore. ### Why When gh_app_id is passed as an integer, PyJWT raises a TypeError on the iss claim during JWT encoding because it expects a string. This surfaces at runtime when the environment variable is parsed as an int rather than str. ### Notes - Only gh_app_id is converted; gh_app_installation_id is left as-is since login_as_app_installation accepts it in its original form - The existing test previously used assert_called_once() without argument checks, so type mismatches like this were invisible; the tightened assertions now catch them - Mirrors the fix in github-community-projects/cleanowners#340 Signed-off-by: jmeridth <jmeridth@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes GitHub App authentication failures when GH_APP_ID is provided as an integer by ensuring the App ID is passed as a string where required.
Changes:
- Convert
gh_app_idtostrbefore callinggithub3’slogin_as_app_installation. - Strengthen and extend unit tests to assert exact
login_as_app_installationcall arguments, including an integerapp_idcase. - Ignore local Claude config artifacts via
.gitignore.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
auth.py |
Coerces gh_app_id to str when authenticating as a GitHub App installation. |
test_auth.py |
Tightens mock assertions and adds a regression test for integer app_id inputs. |
.gitignore |
Adds ignore rule for .claude local files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zkoppert
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Proposed Changes
What
Wrapped gh_app_id with str() in the login_as_app_installation call in auth.py, added targeted tests for integer app_id inputs, and tightened existing test assertions to verify exact call arguments. Also added .claude local files to .gitignore.
Why
When gh_app_id is passed as an integer, PyJWT raises a TypeError on the iss claim during JWT encoding because it expects a string. This surfaces at runtime when the environment variable is parsed as an int rather than str.
Notes
Readiness Checklist
Author/Contributor
make lintand fix any issues that you have introducedmake testand ensure you have test coverage for the lines you are introducing