Skip to content

@actions/github 2.1.0 breaks auth check #324

Closed

Description

@tianhaoz95

Describe the bug
new github.GitHub(token); breaks when upgrade @actions/github from 2.0.1 to 2.1.0 with error message Parameter token or opts.auth is required and trace:

at Function.getAuthString (node_modules/@actions/github/src/github.ts:111:13)
at Function.getOctokitOptions (node_modules/@actions/github/src/github.ts:65:25)
at new GitHub (node_modules/@actions/github/src/github.ts:40:18)
at getOctokit (src/octo.ts:10:15)
at Object.<anonymous> (src/octo.ts:14:24)
at Object.<anonymous> (__tests__/octo.test.ts:2:1)

for details see this action run: https://github.com/tianhaoz95/readable-readme/pull/307/checks?check_run_id=411469798#step:4:97

To Reproduce
Steps to reproduce the behavior:

  1. use @actions/github at version 2.0.1, construct a octokit object
  2. upgrade to 2.1.0
  3. it throws an error

Expected behavior
It should construct the octokit with token given.

Additional context
In the code we can see that 9 days ago this was added:

constructor(token: string, opts?: Omit<Octokit.Options, 'auth'>)

If the octokit is complaining about auth, then it makes me think that there is a check for auth between the construction of the github object and octokit.

Activity

  1. changed the title [-]Github 2.1.0 breaks auth check[/-] [+]@actions/github 2.1.0 breaks auth check[/+] on Jan 27, 2020
  2. tianhaoz95 commented on Jan 29, 2020

    @tianhaoz95
    Author

    nvm, it's a global init error.

  3. thejohnfreeman commented on Apr 18, 2020

    @thejohnfreeman

    What does this mean "it's a global init error"? This is the only Google result for "Parameter token or opts.auth is required".

  4. tianhaoz95 commented on Apr 18, 2020

    @tianhaoz95
    Author

    @thejohnfreeman
    It has been a while since I fixed it in my code. I vaguely remember that it was caused by instantiating the GitHub object globally which went before gathering all the information it needs making it an undefined behavior.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions