Skip to content

regressions on gh token handling #68

Description

@minhtrancccp

merged pr #64 introduced support for gh private token. however, a number of regressions has not been patched before the pr got accepted into the main branch, namely (from the most severe to the least):

  1. environment variable GH_TOKEN is not handled properly in case the variable is unset, leading to program termination when subprocess.run parses the variable. see these GitHubFetcher instance methods:

  2. theoretically, point 1 should not be a problem if an appropriate token is passed when program is first set up. but that token, as a GitHubFetcher instance variable, is not in use anywhere else in the class.

  3. though @Zeviraty has attempted to remove GH_TOKEN usages where the variable is not needed, there still exists two such instances, which are also terminating chokepoints as shown above. the instances are in these methods:

while one waits for a pr to fix these problems, a workaround is to export empty GH_TOKEN:

workaround demonstation
+ declare -f is-token-set
is-token-set () 
{ 
    [ -v GH_TOKEN ] || echo 'token not set'
}
+ is-token-set
+ '[' -v GH_TOKEN ']'
+ echo 'token not set'
token not set
+ gitfetch
Error: expected str, bytes or os.PathLike object, not NoneType
+ export GH_TOKEN=
+ GH_TOKEN=
+ is-token-set
+ '[' -v GH_TOKEN ']'
+ gitfetch
    No contribution data yet              Minh Tran - 0 contributions this year
                                          

+ gitfetch --clear-cache
Cache cleared successfully!

as a final note, it will be great if the program has a better verbose/debug mode, as the error messages (an example is shown in the above demonstration) don't provide enough details to figure out where the errors originate. for this particular issue, i had to spend hours working with pdb to get a grasp on where the trouble was, and i don't wish to repeat this sort of experience when a new issue occurs.

Activity

  1. Zeviraty commented on Dec 18, 2025

    @Zeviraty
    Contributor

    Thank you for the detailed report, its my fault i didnt look through it properly.
    Im working on a fix

  2. Zeviraty commented on Dec 18, 2025

    @Zeviraty
    Contributor

    I have fixed point 1 & 2 in my prs repo, these were really stupid mistakes on my part sorry.

  3. Zeviraty commented on Dec 18, 2025

    @Zeviraty
    Contributor

    Fixed point 3

  4. Zeviraty commented on Dec 18, 2025

    @Zeviraty
    Contributor

    pr opened: #69

  5. Matars commented on Dec 18, 2025

    @Matars
    Owner

    Hi @minhtrancccp @Zeviraty

    Thanks for pointing these things out, I will look at the PR soon and will be working on a better debug output ASAP.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions