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

No such file error in actions when a file was removed in the PR #806

Closed
kaankoken opened this issue Aug 17, 2023 · 10 comments · Fixed by #809
Closed

No such file error in actions when a file was removed in the PR #806

kaankoken opened this issue Aug 17, 2023 · 10 comments · Fixed by #809
Labels
bug Not as expected

Comments

@kaankoken
Copy link

kaankoken commented Aug 17, 2023

I am running typos in GH action in my iOS project on a private repository. I have no problem while running locally.

  spell-check:
    name: Spell Check with Typos
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Check spelling with typos
        uses: crate-ci/typos@master
        with:
          config: ./config/_typos.toml
gh action debug
##[debug]Evaluating condition for step: 'Check spelling with typos'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Check spelling with typos
##[debug]Loading inputs
##[debug]Loading env
Run crate-ci/typos@master
##[debug]Evaluating: inputs.files
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'files'
##[debug]=> ''
##[debug]Result: ''
##[debug]Evaluating: inputs.extend_identifiers
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'extend_identifiers'
##[debug]=> ''
##[debug]Result: ''
##[debug]Evaluating: inputs.extend_words
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'extend_words'
##[debug]=> ''
##[debug]Result: ''
##[debug]Evaluating: inputs.isolated
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'isolated'
##[debug]=> 'false'
##[debug]Result: 'false'
##[debug]Evaluating: inputs.write_changes
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'write_changes'
##[debug]=> 'false'
##[debug]Result: 'false'
##[debug]Evaluating: inputs.config
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'config'
##[debug]=> './config/_typos.toml'
##[debug]Result: './config/_typos.toml'
##[debug]Evaluating condition for step: 'run'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: run
##[debug]Loading inputs
##[debug]Loading env
Run $GITHUB_ACTION_PATH/action/entrypoint.sh
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/481e3597-[2](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:2)66c-4dd6-a798-f4618[3](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:3)b63820.sh
9[4](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:4)f90d277b9b63117b644[5](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:5)9[6](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:6)efe391a191894530
Limiting checks to dev...HEAD
Downloading 'typos' v1.16.5
--2023-08-1[7](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:7) 0[8](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:8):5[9](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:9):34--  https://github.com/crate-ci/typos/releases/download/v1.16.5/typos-v1.16.5-x86_64-unknown-linux-musl.tar.gz
Resolving github.com (github.com)... [14](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:15)0.82.112.4
Connecting to github.com (github.com)|140.82.112.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/181782286/09f789e7-fa07-4987-a0a1-05e2b82e6943?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230817%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230817T085935Z&X-Amz-Expires=300&X-Amz-Signature=9f291e6625e49f2224bb2fc07e93c2448c72ac890085674fb7db972a95374ed1&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=181782286&response-content-disposition=attachment%3B%20filename%3Dtypos-v1.[16](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:17).5-x86_64-unknown-linux-musl.tar.gz&response-content-type=application%2Foctet-stream [following]
--2023-08-[17](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:18) 08:59:35--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/[18](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:19)1782286/09f789e7-fa07-4987-a0a1-05e2b82e6943?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230817%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230817T085935Z&X-Amz-Expires=300&X-Amz-Signature=9f291e6625e49f2224bb2fc07e93c2448c72ac890085674fb7db972a95374ed1&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=181782286&response-content-disposition=attachment%3B%20filename%3Dtypos-v1.16.5-x86_64-unknown-linux-musl.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.[19](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:20)9.110.133, 185.199.111.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... [20](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:21)0 OK
Length: 6509062 (6.2M) [application/octet-stream]
Saving to: ‘typos-v1.16.5-x86_64-unknown-linux-musl.tar.gz’

     0K ........ ........ ........ ........ ........ ........ 48% 35.5M 0s
  3072K ........ ........ ........ ........ ........ ........ 96%  166M 0s
  6144K ...                                                  100%  310M=0.1s

20[23](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:24)-08-17 08:59:[35](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:36) (60.1 MB/s) - ‘typos-v1.16.5-x86_64-unknown-linux-musl.tar.gz’ saved [6[50](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:51)90[62](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:63)/6509062]

./typos
jq: jq-1.6
$ ./typos Gain.xcodeproj/project.pbxproj
Gain.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Gain.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Gain.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Gain/Assets.xcassets/AccentColor.colorset/Contents.json
Gain/Assets.xcassets/AppIcon.appiconset/Contents.json
Gain/Assets.xcassets/Contents.json
Gain/ContentView.swift
Gain/GainApp.swift
Gain/Preview Content/Preview Assets.xcassets/Contents.json
GainTests/GainTests.swift
GainUITests/GainUITests.swift
GainUITests/GainUITestsLaunchTests.swift --config ./config/_typos.toml
No such file or directory (os error 2)
No such file or directory (os error 2)
Error: Process completed with exit code [64](https://github.com/gain-medya/iOS/actions/runs/5888717241/job/15970931021#step:3:65).
##[debug]Finished: run
##[debug]Finishing: Check spelling with typos

I also suspect that the relative path might be the problem but it did not solve it.

 spell-check:
    name: Spell Check with Typos
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Create config path
        run: |
          echo "config=${{ github.workspace }}/config/_typos.toml" >> GITHUB_ENV

      - name: Check spelling with typos
        uses: crate-ci/typos@master
        with:
          config: ${{ env.config }}

_typos.toml

# URL -> https://github.com/crate-ci/typos

[default.extend-identifiers]

[default.extend-words]
commitlint = "commitlint"
conventionalcommits = "conventionalcommits"
[files]
extend-exclude = [
  "**/.vscode/**/",
  "**/*.json",
  "_typos.toml",
  "cspell.config.yaml",
  "**/*.xcodeproj/",
  "**/*.xcworkspace/",
  "**/*.xcassets/",
  "**/*pbxproj",
]
@kaankoken kaankoken changed the title No such file or directory (os error 2) No such file or directory (os error 2) on GitHub Action Aug 17, 2023
@epage
Copy link
Collaborator

epage commented Aug 17, 2023

I tried to reproduce this in one of my repos but was unable to: clap-rs/clap#5077

@kaankoken
Copy link
Author

Could you check this repo @epage test-app

I have created a fresh project (swiftui) to test it with the same action. I tried several things.

First I directly push to master. (no issue) (public)
Second, created a branch (dev) without the swift code then I opened a PR for the swift code (issue) (public/private)

@epage
Copy link
Collaborator

epage commented Aug 18, 2023

Could you retry with 1.16.6? It provides some more context in errors

@kaankoken
Copy link
Author

I re-ran the last failed action again. Output still much the same. You can checkout the same action I pointed out @epage

@epage
Copy link
Collaborator

epage commented Aug 21, 2023

I looked at https://github.com/kaankoken/TestSwiftUIAppWithCI/actions and the last action run was before my post. Is there some place else I'm supposed to look?

@kaankoken
Copy link
Author

this is the last run I had with v1.16.6. When I compared with v1.16.5 it is so similar. Nothing new

Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6511330 (6.2M) [application/octet-stream]
Saving to: ‘typos-v1.16.6-x86_64-unknown-linux-musl.tar.gz’

     0K ........ ........ ........ ........ ........ ........ 48% 85.4M 0s
  3072K ........ ........ ........ ........ ........ ........ 96%  302M 0s
  6144K ...                                                  100%  320M=0.05s

2023-08-19 02:02:31 (136 MB/s) - ‘typos-v1.16.6-x86_64-unknown-linux-musl.tar.gz’ saved [6511330/6511330]

./typos
jq: jq-1.6
$ ./typos TestApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
TestApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
TestApp.xcodeproj/xcuserdata/kaanezgimini.xcuserdatad/xcschemes/xcschememanagement.plist
TestApp/Assets.xcassets/AccentColor.colorset/Contents.json
TestApp/Assets.xcassets/AppIcon.appiconset/Contents.json
TestApp/Assets.xcassets/Contents.json
TestApp/ContentView.swift
TestApp/Preview Content/Preview Assets.xcassets/Contents.json
TestApp/TestApp.entitlements
TestApp/TestAppApp.swift
TestAppTests/TestAppTests.swift
TestAppUITests/TestAppUITests.swift
TestAppUITests/TestAppUITestsLaunchTests.swift
config/_typos.toml --config ./config/_typos.toml
No such file or directory (os error 2)
No such file or directory (os error 2)

@kaankoken
Copy link
Author

kaankoken commented Aug 21, 2023

I have tried with 1.16.7 here and typos were searching for a deleted file

Length: 6510548 (6.2M) [application/octet-stream]
Saving to: ‘typos-v1.16.7-x86_64-unknown-linux-musl.tar.gz’

     0K ........ ........ ........ ........ ........ ........ 48% 80.1M 0s
  3072K ........ ........ ........ ........ ........ ........ 96%  247M 0s
  6144K ...                                                  100%  374M=0.05s

2023-08-21 15:46:13 (124 MB/s) - ‘typos-v1.16.7-x86_64-unknown-linux-musl.tar.gz’ saved [6510548/6510548]

./typos
jq: jq-1.6
$ ./typos TestApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
TestApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
TestApp.xcodeproj/xcuserdata/kaanezgimini.xcuserdatad/xcschemes/xcschememanagement.plist
TestApp/Assets.xcassets/AccentColor.colorset/Contents.json
TestApp/Assets.xcassets/AppIcon.appiconset/Contents.json
TestApp/Assets.xcassets/Contents.json
TestApp/ContentView.swift
TestApp/Preview Content/Preview Assets.xcassets/Contents.json
TestApp/TestApp.entitlements
TestApp/TestAppApp.swift
TestAppTests/TestAppTests.swift
TestAppUITests/TestAppUITests.swift
TestAppUITests/TestAppUITestsLaunchTests.swift
config/_typos.toml --config ./config/_typos.toml
argument `TestApp/Preview` is not found
argument `TestApp/Preview` is not found

@epage
Copy link
Collaborator

epage commented Aug 21, 2023

Ah, I wonder if you retried a job and github doesn't update the timestamp for the whole workflow.

So that means the error is not from the config. I found a couple more places where errors can occur. 1.16.7 is now out with that.

... and I think I figured out what the problem is. The remaining errors were for arguments. We end up filtering the target by the relevant commits but don't do anything to deal with spaces before passing the result into typos.

Unsure if there is fancy bash stuff that can be done so each line from git diff can be passed as a single argument to typos or if something like #708 is needed. Alternatively, we can explore removing that the filtering. It was added in fc7f517 as part of #501. It likely also runs into #347.

@epage
Copy link
Collaborator

epage commented Aug 21, 2023

An immediate workaround is to remove fetch-depth: 0

I wonder where the line is for time spent for git to checkout everything vs typos time to spell check it all...

@epage epage added the bug Not as expected label Aug 21, 2023
@epage epage changed the title No such file or directory (os error 2) on GitHub Action No such file error in actions when a file was removed in the PR Aug 21, 2023
@kaankoken
Copy link
Author

kaankoken commented Aug 21, 2023

@epage I think I led you to wrong problem. When I looked before i thought it was a deleted file. However, the real issue might be the parsing.

The autogenerated folders/files by xcode has a space char between them.
Because "TestApp/Preview:spacechar:..."

I am very sorry for the whole hustle

epage added a commit to epage/typos that referenced this issue Aug 21, 2023
This reverts commit fc7f517.

This has two problems
- This doesn't correctly handle spaces, likely needing crate-ci#708
- This overrides excludes, see crate-ci#347

This also has a weird cost/benefit balance because this requires enough
repo history to do the analysis which takes time to pull down.

Rather than waiting until the relevant changes are in to make this work,
I'm pulling this out for now.

Fixes crate-ci#806
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants