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

[BUG] missing opening '(' then stop with windows-latest #562

Closed
3 tasks done
sangshuduo opened this issue Aug 4, 2022 · 3 comments
Closed
3 tasks done

[BUG] missing opening '(' then stop with windows-latest #562

sangshuduo opened this issue Aug 4, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@sangshuduo
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Does this issue exist in the latest version?

  • I'm using the latest release

Describe the bug?

My action's runs-on is windows-latest

the error message is:

ParserError: D:\a_temp\53945d85-e140-4e9e-baf5-4928a0b9745a.ps1:2
Line |
2 | for file in .github/workflows/windows.yml inc/bench.h src/CMakeLists. …
| ~
| Missing opening '(' after keyword 'for'.

To Reproduce

add following text to my script:

      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@v24.1

      - name: List all changed files
        run: |
          for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
            echo "$file was changed"
          done
      - name: Get specific changed files
        id: changed-files-specific
        uses: tj-actions/changed-files@v24.1
        with:
          files: |
            src/*
            inc/*
            deps/CMakeLists.txt
            .github/workflows/windows.yml

run the workflow

What OS are you seeing the problem on?

windows-latest or windows-2019

Expected behavior?

work as what it work with linux

Relevant log output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sangshuduo sangshuduo added the bug Something isn't working label Aug 4, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2022

Thanks for reporting this issue, don't forget to star this project to help us reach a wider audience.

@jackton1
Copy link
Member

jackton1 commented Aug 4, 2022

@sangshuduo it appears there’s an unescaped character in the filename which is the cause of the error you are seeing. I'll recommend switching from bash loops to natively supported GitHub action function.

CHANGE

for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
  echo "$file was changed"
done

TO

echo '${{ toJSON(steps.changed-files.outputs) }}'

It would be helpful to also post the filename.

@jackton1 jackton1 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2022
@sangshuduo
Copy link
Author

@sangshuduo it appears there an unescaped characters in the filenames which is the cause of the error you are seeing. I'll recommend switching from bash loops to natively supported GitHub action function.

CHANGE

for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
  echo "$file was changed"
done

TO

echo '${{ toJSON(steps.changed-files.outputs) }}'

It would be helpful to also post the filename.

thanks. it works good.

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

No branches or pull requests

2 participants