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] Will output all changed files if not file matches the **/*.sql pattern #565

Closed
3 tasks done
ecmadao opened this issue Aug 8, 2022 · 4 comments · Fixed by #566
Closed
3 tasks done

[BUG] Will output all changed files if not file matches the **/*.sql pattern #565

ecmadao opened this issue Aug 8, 2022 · 4 comments · Fixed by #566
Labels
bug Something isn't working

Comments

@ecmadao
Copy link

ecmadao commented Aug 8, 2022

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?

If the files pattern contains **/*.sql, and it didn't match any changed files in the pull request, will print a warning:

No match found for specified patterns. Ensure that subdirectory patterns are prefixed with "**/" and all multi line string patterns are specified without quotes. See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet

And the action will output all changed files, seems this doesn't make sense.

To Reproduce

  1. Create a workflow like:
on: [pull_request]

jobs:
  test-workflow:
    runs-on: ubuntu-latest
    name: Changed files
    steps:
      - uses: actions/checkout@v3
      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@v24.1
        with:
          files: |
            **/*.sql 
      - name: Echo files
        run: echo ${{ steps.changed-files.outputs.all_changed_files }}
        shell: bash

Note: the files must has the pattern: **/*.sql

  1. Make some changes (not change any SQL files)
  2. Create the pull request and check the action.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

The action should return empty as no changed files can match the **/*.sql pattern.

Relevant log output

No response

Anything else?

N/A

Code of Conduct

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

github-actions bot commented Aug 8, 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 8, 2022

The solution here would be to validate the patterns.

@ecmadao ecmadao changed the title [BUG] Will output all changed files if not file matches the **/*.sql pattern [BUG] Will output all changed files if not file matches the **/*.xxx pattern Aug 8, 2022
@ecmadao ecmadao changed the title [BUG] Will output all changed files if not file matches the **/*.xxx pattern [BUG] Will output all changed files if not file matches the **/*.sql pattern Aug 8, 2022
@ecmadao
Copy link
Author

ecmadao commented Aug 8, 2022

The interesting thing is if the pattern is something like **/*.md, and even though the PR doesn't have any markdown file changes, it works well with empty output. I only found this issue if the pattern is **/*.sql

@jackton1
Copy link
Member

jackton1 commented Aug 8, 2022

That's strange, I'll expect the warning to show up for non valid glob patterns

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