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] Infinite loop on v34.4.0 #803

Closed
2 tasks done
tsigouris007 opened this issue Nov 15, 2022 · 8 comments · Fixed by #804
Closed
2 tasks done

[BUG] Infinite loop on v34.4.0 #803

tsigouris007 opened this issue Nov 15, 2022 · 8 comments · Fixed by #804
Labels
bug Something isn't working

Comments

@tsigouris007
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?

The step gets stuck in an infinite loop while checking out.
I am using it to get changed files to scan with Semgrep on a Pull Request.
Changing my step to version 34.3.4 does not raise the same issue.
The loop gets stuck as seen in the attached image:

ksnip_20221115-113140

To Reproduce

name: Semgrep (JS) - JS, Python, Go Security Scan
on:
  pull_request:
    paths:
      - '**.js'
      - '**.jsx'
      - '.github/workflows/semgrep-js.yml'
  workflow_dispatch:
jobs:
  semgrep:
    # Skip job if draft
    if: github.event.pull_request.draft == false
    name: Semgrep run
    runs-on: ubuntu-latest
      # Check out current branch if PR
      - name: Check out (PR)
        if: ${{ github.event_name == 'pull_request' }}
        uses: actions/checkout@v3
      # Skip changed files and filtering on PR
      - name: Get changed files (PR)
        if: ${{ github.event_name == 'pull_request' }}
        id: changed-files
        uses: tj-actions/changed-files@v34.3.4 # Test
        with:
          files: |
            **.js
            **/**.js
            **.jsx
            **/**.jsx
      # Show changed files on PR and push them to environment as CHANGED_FILES
      - name: Show changed files (PR)
        if: ${{ github.event_name == 'pull_request' }}
        run: |
          ALL_CHANGED_FILES=$(echo ${{ steps.changed-files.outputs.all_changed_files }})
          echo "Got changed files: $ALL_CHANGED_FILES"
...

Skipped the rest as the execution does not continue any further anyways.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

To work properly.

Relevant log output

See attached image.
Stuck on:

From repo
* branch master -> FETCH_HEAD
* branch HEAD   -> FETCH_HEAD


### Anything else?

Nope 😄 

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
@tsigouris007 tsigouris007 added the bug Something isn't working label Nov 15, 2022
@github-actions
Copy link
Contributor

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

@tsigouris007
Copy link
Author

tsigouris007 commented Nov 15, 2022

If I use with fetch-depth: 0 it does seem to work.

      - name: Check out (PR)
        if: ${{ github.event_name == 'pull_request' }}
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Get changed files (PR)
        if: ${{ github.event_name == 'pull_request' }}
        id: changed-files
        uses: tj-actions/changed-files@v34.4.0
        with:
          files: |
            **.js
            **/**.js
            **.jsx
            **/**.jsx

This does increase run times but if we cannot move further I guess I can leave it like this.
This does not actually work and is related to the previous #802 issue.

@jackton1 jackton1 linked a pull request Nov 15, 2022 that will close this issue
@jackton1
Copy link
Member

jackton1 commented Nov 16, 2022

@tsigouris007 I'll like to point out that the patterns you highlighted aren't valid. You can take a look at the patterns to match file paths for more information. I must have misread the patterns as I see the intended use now. Thanks for clarifying.

@tsigouris007
Copy link
Author

tsigouris007 commented Nov 16, 2022

Hi @jackton1 apart from the patterns the infinite loop did not stop.
But also, why are they not valid?
I have been using them for quite some time on a production environment and have been used for more than 15k runs without a problem and producing right results. What am I not doing right?

I'm guessing I could omit the ones that look like **/** and only keep the **.js + **.jsx but they do not change how this behaves as far as I've seen.

@tsigouris007
Copy link
Author

Unfortunately this is not solved.

ksnip_20221116-120620

Using 34.4.0 version runs for more than 6 minutes without any proper result.
Reverting to 34.3.4 it works.

The step used for this is:

      - name: Get changed files (PR)
        id: changed-files
        uses: tj-actions/changed-files@v34.4.0
        with:
          files: |
            **.js
            **.jsx

@tsigouris007
Copy link
Author

tsigouris007 commented Nov 16, 2022

Hello again @jackton1 ,
Regarding my patterns they are actually correct as they were in the first place. I thoroughly verified them while testing. Using only **.extension does not include sub-directories, you actually need the **/**.extension for this to include everything.

The only solution to this as far as I see atm is to keep using this:

      - name: Check out (PR)
        if: ${{ github.event_name == 'pull_request' }}
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Get changed files (PR)
        if: ${{ github.event_name == 'pull_request' }}
        id: changed-files
        uses: tj-actions/changed-files@v34.3.4
        with:
          files: |
            **.js
            **/**.js
            **.jsx
            **/**.jsx

@jackton1
Copy link
Member

jackton1 commented Nov 16, 2022

@tsigouris007 Have you tried upgrading to the latest version?

@tsigouris007
Copy link
Author

@jackton1 seems like v34.4.2 does the trick.
Thank you very much.

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

Successfully merging a pull request may close this issue.

2 participants