Skip to content
New issue

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

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

Already on GitHub? # to your account

[BUG] ##[error]Parameter token or opts.auth is required #465

Closed
rodrigondec opened this issue May 18, 2020 · 2 comments
Closed

[BUG] ##[error]Parameter token or opts.auth is required #465

rodrigondec opened this issue May 18, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@rodrigondec
Copy link

rodrigondec commented May 18, 2020

Describe the bug
I reported this bug on the action I'm using: alex-page/github-project-automation-plus#39.

read this issue to have better understanding of the discussions we had.

I'm receiving the error ##[error]Parameter token or opts.auth is required on this run on my CI

I found this issue #324 by googling the error returned.

On this line of code of the action I'm using is used:

const octokit = new github.GitHub(token);

In the package @actions/github on this line of code (which probably raises the error) is used:

constructor(token: string, opts?: Omit<Octokit.Options, 'auth'>)
  constructor(opts: Octokit.Options)
  constructor(token: string | Octokit.Options, opts?: Octokit.Options) {
    super(GitHub.getOctokitOptions(GitHub.disambiguate(token, opts)))

    this.graphql = GitHub.getGraphQL(GitHub.disambiguate(token, opts))
  }

Github extends Ocktokit. So is super = Ocktokit

In the package @ocktokit/core on this line of code there's the following explanation/documentation:

constructor(options: OctokitOptions = {}) {
[...]

// (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
    //     is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred.
    // (2) If only `options.auth` is set, use the default token authentication strategy.
    // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
    // TODO: type `options.auth` based on `options.authStrategy`.

To Reproduce
Steps to reproduce the behavior:

  1. Go to this run
  2. Click on 're-run all jobs'
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image
image

Additional context
Should be passed others args besides the token on this line from the action?

const octokit = new github.GitHub(token);

The construct does accept other options:

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

On the official documentation of @actions/github is used only token on the constructor.

Did we miss some official documentation? Should issue be opened on @ocktokit/core?

@rodrigondec rodrigondec added the bug Something isn't working label May 18, 2020
@thboop
Copy link
Collaborator

thboop commented May 18, 2020

Hey @rodrigondec,

I think you are encountering a different issue here. For security, Secrets are not currently available to forks.

This call to getInput is likely returning the empty string.

const octokit = new github.GitHub(""), will return that error message.

The forked repo likely does not have this secret set.

We are currently evaluating features to enable secrets in forks

@rodrigondec
Copy link
Author

Hey @rodrigondec,

I think you are encountering a different issue here. For security, Secrets are not currently available to forks.

This call to getInput is likely returning the empty string.

const octokit = new github.GitHub(""), will return that error message.

The forked repo likely does not have this secret set.

We are currently evaluating features to enable secrets in forks

It makes sense. Ty for the response.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants