yegorrybchenko / go-swag-action

MIT License
3 stars 2 forks source link

Swag fmt not throws error #22

Open Nibba2018 opened 1 year ago

Nibba2018 commented 1 year ago

Hello, Thank you for the project.

When I try to run swag fmt I have the following error:


Run yegorrybchenko/go-swag-action@v0.1
  with:
    command: fmt ./...
    swagWersion: 1.8.7
Installing swag tool 1.8.7 ...
Unexpected error attempting to determine if executable file exists '/home/runner/swag/tar': Error: ENOTDIR: not a directory, stat '/home/runner/swag/tar'
Unexpected error attempting to determine if executable file exists '/home/runner/swag/tar': Error: ENOTDIR: not a directory, stat '/home/runner/swag/tar'
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/346a8a4f-967e-4b65-9165-4a542d01cfea -f /home/runner/work/_temp/a554da27-47ee-43a3-bcb8-ef0f7c4f7c5e
/home/runner/swag fmt ./...

Could you please share some fix. Thank you.

yegorrybchenko commented 1 year ago

Hi @Nibba2018 . Thanks for the feeback. Seems that machine/image you are using for the action does not have tar tool. You can add tar to your image or use another github action to install it.

I tested with default ubuntu-latest image that has tar by default and it works:

jobs:
  testIssue:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./
        with:
          command: fmt -d example_test ./...
          swagWersion: 1.8.7

Code: https://github.com/yegorrybchenko/go-swag-action/blob/swag-fmt-fix/.github/workflows/test-issue.yml Result: https://github.com/yegorrybchenko/go-swag-action/actions/runs/3543316092/jobs/5949656924

I will update docs for that