Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@actions/github 2.1.0 breaks auth check #324

Closed
tianhaoz95 opened this issue Jan 27, 2020 · 3 comments
Closed

@actions/github 2.1.0 breaks auth check #324

tianhaoz95 opened this issue Jan 27, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@tianhaoz95
Copy link

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.

@tianhaoz95 tianhaoz95 added the bug Something isn't working label Jan 27, 2020
@tianhaoz95 tianhaoz95 changed the title Github 2.1.0 breaks auth check @actions/github 2.1.0 breaks auth check Jan 27, 2020
@tianhaoz95
Copy link
Author

nvm, it's a global init error.

@thejohnfreeman
Copy link

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

@tianhaoz95
Copy link
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
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants