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

Fails to run with error: Unable to compile TypeScript error #560

Closed
tgallacher opened this issue Oct 13, 2022 · 4 comments
Closed

Fails to run with error: Unable to compile TypeScript error #560

tgallacher opened this issue Oct 13, 2022 · 4 comments

Comments

@tgallacher
Copy link

Summary

This action failed to run on a Typescript project, with a tsconfig.json. Received the following error:

error running commitlint
⨯ Unable to compile TypeScript:
error TS6053: File '<redacted>' not found.

TSError: ⨯ Unable to compile TypeScript:
error TS6053: File '<redacted>' not found.

    at createTSError (/node_modules/ts-node/src/index.ts:859:[12])
    at reportTSError (/node_modules/ts-node/src/index.ts:863:19)
    ...

The <redacted> "file" is an internal TS config package (private registry).

This is the Github workflow:

name: Standards

on:
  pull_request:

jobs:
  commitlint:
    name: Commitlint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        # required to get all history, not just commit that triggers current run
        with:
          fetch-depth: 0

      - uses: wagoid/commitlint-github-action@v5
        with:
          configFile: commitlint.config.js

This issue appears to be related to conventional-changelog/commitlint#3256.

Note: I managed to find a workaround by downgrading to v4 of this action: wagoid/commitlint-github-action@v4

@wagoid
Copy link
Owner

wagoid commented Oct 13, 2022

Hi @tgallacher, thanks for submitting this issue! Looks like we'll need to wait for commitlint to fix this issue, as ths workaround from this comment is not possible in this action.

The good thing is that it doesn't happen on all Typescript projects, I run this action in other TS projects and it doesn't fail 😌

Another workaround I can suggest to you, so that you can keep running this action in v5, is to delete tsconfig.json right before linting:

name: Standards

on:
  pull_request:

jobs:
  commitlint:
    name: Commitlint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        # required to get all history, not just commit that triggers current run
        with:
          fetch-depth: 0

      - run: rm tsconfig.json

      - uses: wagoid/commitlint-github-action@v5
        with:
          configFile: commitlint.config.js

I can't run this rm tsconfig.json as part of this action's workflow since this may impact people's workflows, so I can only suggest as a workaround on your case. I'll close this issue, but let me know if you need any more help 💪

@wagoid wagoid closed this as completed Oct 13, 2022
@schw4rzlicht
Copy link

It also hit one of our repos today. Can we probably re-open this issue and close it when it's fixed?

@gabrielbull
Copy link

gabrielbull commented Nov 22, 2022

Yeah me too. Mine is because my tsconfig extends react native's one and its of course not installed when running with this action: "extends": "@tsconfig/react-native/tsconfig.json"

Throws:

error running commitlint
[12](/actions/runs/3524613370/jobs/5910254727#step:4:13)
⨯ Unable to compile TypeScript:
[13](/actions/runs/3524613370/jobs/5910254727#step:4:14)
error TS6053: File '@tsconfig/react-native/tsconfig.json' not found.
[14](/actions/runs/3524613370/jobs/5910254727#step:4:15)

[15](/actions/runs/3524613370/jobs/5910254727#step:4:16)
TSError: ⨯ Unable to compile TypeScript:
[16](/actions/runs/3524613370/jobs/5910254727#step:4:17)
error TS6053: File '@tsconfig/react-native/tsconfig.json' not found.
[17](/actions/runs/3524613370/jobs/5910254727#step:4:18)

[18](/actions/runs/3524613370/jobs/5910254727#step:4:19)
    at createTSError (/node_modules/ts-node/src/index.ts:859:12)
[19](/actions/runs/3524613370/jobs/5910254727#step:4:20)
    at reportTSError (/node_modules/ts-node/src/index.ts:863:19)
[20](/actions/runs/3524613370/jobs/5910254727#step:4:21)
    at createFromPreloadedConfig (/node_modules/ts-node/src/index.ts:874:36)
[21](/actions/runs/3524613370/jobs/5910254727#step:4:22)
    at create (/node_modules/ts-node/src/index.ts:624:10)
[22](/actions/runs/3524613370/jobs/5910254727#step:4:23)
    at register (/node_modules/ts-node/src/index.ts:591:15)
[23](/actions/runs/3524613370/jobs/5910254727#step:4:24)
    at TypeScriptLoader (/node_modules/cosmiconfig-typescript-loader/dist/cjs/index.js:52:54)
[24](/actions/runs/3524613370/jobs/5910254727#step:4:25)
    at loadConfig (/node_modules/@commitlint/load/src/utils/load-config.ts:35:27)
[25](/actions/runs/3524613370/jobs/5910254727#step:4:26)
    at Object.load [as default] (/node_modules/@commitlint/load/src/load.ts:25:33)
[26](/actions/runs/3524613370/jobs/5910254727#step:4:27)
    at showLintResults (/run.js:295:76)
[27](/actions/runs/3524613370/jobs/5910254727#step:4:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@wagoid
Copy link
Owner

wagoid commented Nov 22, 2022

I closed the issue because there's nothing I can do in the action, could you guys try the workaround from my comment? #560 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants