stoplightio / spectral-action

GitHub Action wrapper for Spectral - a JSON/YAML/OpenAPI/AsyncAPI/etc linter with custom rule support.
https://stoplight.io/open-source/spectral
Apache License 2.0
90 stars 46 forks source link

Build broken since latest changes #657

Closed unity-jbasso closed 11 months ago

unity-jbasso commented 11 months ago

The build of the action is throwing an error

Context

Following the recent changes on the repository, the action does not build anymore.

Current Behavior

At the TS build step of the Dockerfile tsc -p tsconfig.json The build returns errors.

    Type 'TaskEither<Error, string[]>' is not assignable to type 'TaskEither<never, string[]>'.
      Type 'Error' is not assignable to type 'never'.
  src/index.ts(125,3): error TS2345: Argument of type 'IOEither<ProcessEnv, Error>' is not assignable to parameter of type 'IOEither<Error, Error>'.
    Type 'Dict<string>' is missing the following properties from type 'Error': name, message
  src/index.ts(125,45): error TS2345: Argument of type 'IO<{}>' is not assignable to parameter of type 'IO<Error>'.
    Type '{}' is missing the following properties from type 'Error': name, message
  src/index.ts(126,45): error TS2345: Argument of type 'Error' is not assignable to parameter of type 'ProcessEnv'.
    Index signature for type 'string' is missing in type 'Error'.
  src/index.ts(135,3): error TS2345: Argument of type '(ma: TaskEither<Error, { readonly config: { GITHUB_EVENT_PATH: string; INPUT_REPO_TOKEN: string; GITHUB_WORKSPACE: string; INPUT_FILE_GLOB: string; INPUT_EVENT_NAME: string; INPUT_SPECTRAL_RULESET: string; GITHUB_SERVER_URL: string; }; readonly repositoryInfo: RepositoryInfo; }>) => TaskEither<...>' is not assignable to parameter of type '(c: TaskEither<Error, { readonly config: { GITHUB_EVENT_PATH: string; INPUT_REPO_TOKEN: string; GITHUB_WORKSPACE: string; INPUT_FILE_GLOB: string; INPUT_EVENT_NAME: string; INPUT_SPECTRAL_RULESET: string; GITHUB_SERVER_URL: string; }; readonly repositoryInfo: RepositoryInfo; }>) => TaskEither<...>'.
    Type 'TaskEither<Error, { readonly config: { GITHUB_EVENT_PATH: string; INPUT_REPO_TOKEN: string; GITHUB_WORKSPACE: string; INPUT_FILE_GLOB: string; INPUT_EVENT_NAME: string; INPUT_SPECTRAL_RULESET: string; GITHUB_SERVER_URL: string; }; readonly repositoryInfo: RepositoryInfo; readonly octokit: { ...; } & ... 3 more ... &...' is not assignable to type 'TaskEither<never, { readonly config: { GITHUB_EVENT_PATH: string; INPUT_REPO_TOKEN: string; GITHUB_WORKSPACE: string; INPUT_FILE_GLOB: string; INPUT_EVENT_NAME: string; INPUT_SPECTRAL_RULESET: string; GITHUB_SERVER_URL: string; }; readonly repositoryInfo: RepositoryInfo; readonly octokit: { ...; } & ... 3 more ... &...'.
      Type 'Error' is not assignable to type 'never'.
  src/index.ts(169,1): error TS1[80](https://github.com/Unity-Technologies/unity-services-api-docs/actions/runs/7279457062/job/19836789286?pr=1296#step:3:80)46: 'program' is of type 'unknown'.
  src/index.ts(169,16): error TS7006: Parameter 'result' implicitly has an 'any' type.
  src/index.ts(173,18): error TS18046: 'e' is of type 'unknown'.

Those errors can be reproduced locally running yarn build.

Expected Behavior

The docker image builds correctly.

Possible Workaround/Solution

The regression is caused by this PR https://github.com/stoplightio/spectral-action/pull/656, likely a dependency issue. Reverting the merge commit solves the issue.

Introducing an automated test that the docker image builds could prevent this from happening.

Steps to Reproduce

Run yarn build OR Build docker image of the action

Environment

danielolivaresd commented 11 months ago

FYI, the workaround in the meantime is uses: stoplightio/spectral-action@v0.8.10

mnaumanali94 commented 11 months ago

@danielolivaresd We're looking into this at the moment! We should have a fix soon

mnaumanali94 commented 11 months ago

Meanwhile the latest tag should point to the old release now and be working as before.

mnaumanali94 commented 11 months ago

The latest version should work now. @unity-jbasso @danielolivaresd