changed-files: [BUG] Modified files treated as `Non Matching modified files`

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?

Files that are modified in the pull request are being somehow skipped. It is funny because I do it for 3 packages in monorepo and dashboard is the only one that acts this way.

To Reproduce

  1. I have two next.js apps homepage and dashboard and ui package in turborepo.
  2. I have the following quality-gate job.
jobs:
  eslint:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          - app_scope: ui
            package_path: ./packages/ui
            eslint_flags: '**/*.{ts,tsx}'
            files: |
              packages/ui/**
              packages/jest-config/**
              packages/linters-config/**
              packages/tsconfig/**
              packages/types/**
              .github/actions/checkout-remote-actions/action.yml
              .github/workflows/quality-gate.yml
          - app_scope: homepage
            package_path: ./apps/homepage
            eslint_flags: '--quiet **/*.{ts,tsx}'
            files: |
              apps/homepage/**
              packages/app-config/**
              .github/actions/checkout-remote-actions/action.yml
              .github/workflows/quality-gate.yml
          - app_scope: dashboard
            package_path: ./apps/dashboard
            eslint_flags: '**/*.{ts,tsx}'
            files: |
              apps/dashboard/**/*
              packages/app-config/**/*
              packages/jest-config/**/*
              packages/linters-config/**/*
              packages/tsconfig/**/*
              packages/types/**/*
              packages/ui/**/*
              packages/webpack-loaders/**/*
              .github/actions/checkout-remote-actions/action.yml
              .github/workflows/quality-gate.yml
    steps:
      - uses: actions/checkout@v3

      - name: Get specific changed files
        id: changed_files
        uses: tj-actions/changed-files@v18.4
        with:
          files: ${{ matrix.files }}

      - name: Show output json
        run: |
          echo "${{ toJSON(steps.changed_files.outputs) }}"

      - name: No file was modified
        if: steps.changed_files.outputs.any_modified == 'false'
        run: |
          echo "None of the files listed above was modified."

      - name: Files was modified
        if: steps.changed_files.outputs.any_modified == 'true'
        run: |
          echo "Rest of the job steps go here."
  1. I’ve deleted some actions definitions and modified files in ui, homepage and dashboard to test it jobs are triggering.
  2. ui and homepage works as expected - dashboard have issues.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

If files from the provided files list are modified, then they should be recognized as modified files.

Relevant log output

### dashboard eslint starts here ###

Run tj-actions/changed-files@v18.4
  with:
    files: apps/dashboard/**
  packages/app-config/**
  packages/jest-config/**
  packages/linters-config/**
  packages/tsconfig/**
  packages/types/**
  packages/ui/**
  packages/webpack-loaders/**
  .github/actions/checkout-remote-actions/action.yml
  .github/workflows/quality-gate.yml
  
    token: ***
    separator:  
    files_separator: 
  
    files_ignore_separator: 
  
    sha: 4766508dda1eb2aa0024a5993125cd28ad15976d
    since_last_remote_commit: false
    use_fork_point: false
  env:
    REVIEWDOG_LEVEL: error
    REVIEWDOG_FILTER_MODE: file
    REVIEWDOG_REPORTER: github-pr-review
Run # "Set base sha..."
Run # "Calculating the previous and current SHA..."
changed-files-diff-sha
Run tj-actions/glob@v7.10
  with:
    files: apps/dashboard/**
  packages/app-config/**
  packages/jest-config/**
  packages/linters-config/**
  packages/tsconfig/**
  packages/types/**
  packages/ui/**
  packages/webpack-loaders/**
  .github/actions/checkout-remote-actions/action.yml
  .github/workflows/quality-gate.yml
  
    files-separator: 
  
    excluded-files-separator: 
  
    base-sha: 4edc0786a63e176c429514293013c787b5d68018
    sha: 4766508dda1eb2aa0024a5993125cd28ad15976d
    include-deleted-files: true
    separator: |
    files-from-source-file-separator: 
  
    excluded-files-from-source-file-separator: 
  
    follow-symbolic-links: true
    strip-top-level-dir: true
  env:
    REVIEWDOG_LEVEL: error
    REVIEWDOG_FILTER_MODE: file
    REVIEWDOG_REPORTER: github-pr-review
/usr/bin/git rev-parse --show-toplevel
/home/runner/work/#REDACTED#
/usr/bin/git diff --diff-filter=D --name-only 4edc0786a63e176c429514293013c787b5d68018 4766508dda1eb2aa0024a5993125cd28ad15976d
.github/workflows/dashboard-quality-gate.yml
.github/workflows/homepage-quality-gate.yml
.github/workflows/storybook-quality-gate.yml
.github/workflows/ui-quality-gate.yml


Successfully created paths-output-file: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt
Run bash $GITHUB_ACTION_PATH/entrypoint.sh
  bash $GITHUB_ACTION_PATH/entrypoint.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    REVIEWDOG_LEVEL: error
    REVIEWDOG_FILTER_MODE: file
    REVIEWDOG_REPORTER: github-pr-review
    GITHUB_ACTION_PATH: /home/runner/work/_actions/tj-actions/changed-files/v18.4
    INPUT_FILES_PATTERN_FILE: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt
    INPUT_SEPARATOR:  
    INPUT_PATH: 
    INPUT_PREVIOUS_SHA: 4edc0786a63e176c429514293013c787b5d68018
    INPUT_CURRENT_SHA: 4766508dda1eb2aa0024a5993125cd28ad15976d
    INPUT_TARGET_BRANCH: develop
    INPUT_CURRENT_BRANCH: chore/merge-quality-gate
changed-files
  Resolving repository path...
  Retrieving changes between 4edc0786a63e176c429514293013c787b5d68018 (develop) → 4766508dda1eb2aa0024a5993125cd28ad15976d (chore/merge-quality-gate)
  Getting diff...
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  grep: /tmp/527d24c3-451b-4168-9d1f-bce23c6fffa2.txt:1: Unmatched [, [^, [:, [., or [=
  Non Matching changed files: .github/workflows/quality-gate.yml apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx apps/dashboard/src/common/transforms/parseDate/parseDate.ts apps/homepage/src/components/organisms/RfpModal/OfficeForm.tsx packages/ui/components/NavigationBar/NavigationBar.tsx
  Non Matching modified files: .github/workflows/dashboard-quality-gate.yml .github/workflows/homepage-quality-gate.yml .github/workflows/quality-gate.yml .github/workflows/storybook-quality-gate.yml .github/workflows/ui-quality-gate.yml apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx apps/dashboard/src/common/transforms/parseDate/parseDate.ts apps/homepage/src/components/organisms/RfpModal/OfficeForm.tsx packages/ui/components/NavigationBar/NavigationBar.tsx
  Non Matching deleted files: .github/workflows/dashboard-quality-gate.yml .github/workflows/homepage-quality-gate.yml .github/workflows/storybook-quality-gate.yml .github/workflows/ui-quality-gate.yml
  Added files: 
  Copied files: 
  Deleted files: 
  Modified files: 
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed and modified files: 
  All changed files: 
  All modified files: 

### dashboard eslint ends here ###


### homepage eslint starts here ###

Run tj-actions/changed-files@v18.4
  with:
    files: apps/homepage/**
  packages/app-config/**
  .github/actions/checkout-remote-actions/action.yml
  .github/workflows/quality-gate.yml
  
    token: ***
    separator:  
    files_separator: 
  
    files_ignore_separator: 
  
    sha: 4766508dda1eb2aa0024a5993125cd28ad15976d
    since_last_remote_commit: false
    use_fork_point: false
  env:
    REVIEWDOG_LEVEL: error
    REVIEWDOG_FILTER_MODE: file
    REVIEWDOG_REPORTER: github-pr-review
Run # "Set base sha..."
Run # "Calculating the previous and current SHA..."
changed-files-diff-sha
Run tj-actions/glob@v7.10
  with:
    files: apps/homepage/**
  packages/app-config/**
  .github/actions/checkout-remote-actions/action.yml
  .github/workflows/quality-gate.yml
  
    files-separator: 
  
    excluded-files-separator: 
  
    base-sha: 4edc0786a63e176c429514293013c787b5d68018
    sha: 4766508dda1eb2aa0024a5993125cd28ad15976d
    include-deleted-files: true
    separator: |
    files-from-source-file-separator: 
  
    excluded-files-from-source-file-separator: 
  
    follow-symbolic-links: true
    strip-top-level-dir: true
  env:
    REVIEWDOG_LEVEL: error
    REVIEWDOG_FILTER_MODE: file
    REVIEWDOG_REPORTER: github-pr-review
/usr/bin/git rev-parse --show-toplevel
/home/runner/work/#REDACTED#
/usr/bin/git diff --diff-filter=D --name-only 4edc0786a63e176c429514293013c787b5d68018 4766508dda1eb2aa0024a5993125cd28ad15976d
.github/workflows/dashboard-quality-gate.yml
.github/workflows/homepage-quality-gate.yml
.github/workflows/storybook-quality-gate.yml
.github/workflows/ui-quality-gate.yml


Successfully created paths-output-file: /tmp/abbdb673-5b37-4bf3-86c6-a414a0df883a.txt
Run bash $GITHUB_ACTION_PATH/entrypoint.sh
changed-files
  Resolving repository path...
  Retrieving changes between 4edc0786a63e176c429514293013c787b5d68018 (develop) → 4766508dda1eb2aa0024a5993125cd28ad15976d (chore/merge-quality-gate)
  Getting diff...
  Matching changed files: .github/workflows/quality-gate.yml|apps/homepage/src/components/organisms/RfpModal/OfficeForm.tsx
  Non Matching changed files: apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx apps/dashboard/src/common/transforms/parseDate/parseDate.ts packages/ui/components/NavigationBar/NavigationBar.tsx
  Matching modified files: .github/workflows/quality-gate.yml|apps/homepage/src/components/organisms/RfpModal/OfficeForm.tsx
  Non Matching modified files: .github/workflows/dashboard-quality-gate.yml .github/workflows/homepage-quality-gate.yml .github/workflows/storybook-quality-gate.yml .github/workflows/ui-quality-gate.yml apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx apps/dashboard/src/common/transforms/parseDate/parseDate.ts packages/ui/components/NavigationBar/NavigationBar.tsx

### homepage eslint ends here ###

Anything else?

No response

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Found the issue I’ll create a fix later today

Hi @jackton1, I’ve reproduced the situation in public repository – you can verify the outcome here https://github.com/miszo/tj-actions_changed-files/actions/workflows/quality-gate.yml

I’ve added you as a contributor to the repo, so feel free to create another branch and play with the patterns.

@miszo Oh okay, it should be resolved for all apps now using the latest release.

No worries. Thanks for creating the public/private repositories they were super helpful in resolving this.

@jackton1, It works a charm! Thanks for the fix!

Have a great day!

@jackton1, but I’ve modified .github/workflows/quality-gate.yml file and deleted .github/workflows/homepage-quality-gate.yml. So, I assume that it should mark the file .github/workflows/quality-gate.yml as modified.

@jackton1, looks like last change resolved the issue for dashboard.

Run tj-actions/changed-files@fix/bug-with-pattern-matching
  with:
    files: apps/dashboard/**
  packages/app-config/**
  packages/jest-config/**
  packages/linters-config/**
  packages/tsconfig/**
  packages/types/**
  packages/ui/**
  packages/webpack-loaders/**
  .github/actions/checkout-remote-actions/action.yml
  .github/workflows/quality-gate.yml
  
    token: ***
    separator:  
    files_separator: 
  
    files_ignore_separator: 
  
    sha: 3ccf5234dc28c9ce4c1b695758a0456acd450489
    since_last_remote_commit: false
    use_fork_point: false
  env:
    REVIEWDOG_LEVEL: error
    REVIEWDOG_FILTER_MODE: file
    REVIEWDOG_REPORTER: github-pr-review
Run # "Set base sha..."
Run # "Calculating the previous and current SHA..."
changed-files-diff-sha
Run tj-actions/glob@v7.14
  with:
    files: apps/dashboard/**
  packages/app-config/**
  packages/jest-config/**
  packages/linters-config/**
  packages/tsconfig/**
  packages/types/**
  packages/ui/**
  packages/webpack-loaders/**
  .github/actions/checkout-remote-actions/action.yml
  .github/workflows/quality-gate.yml
  
    files-separator: 
  
    escape-paths: true
    excluded-files-separator: 
  
    base-sha: be7c6fbeb28d8f9439582d1936aa2a3f269d759a
    sha: 3ccf5234dc28c9ce4c1b695758a0456acd450489
    include-deleted-files: true
    separator: |
    files-from-source-file-separator: 
  
    excluded-files-from-source-file-separator: 
  
    follow-symbolic-links: true
    strip-top-level-dir: true
  env:
    REVIEWDOG_LEVEL: error
    REVIEWDOG_FILTER_MODE: file
    REVIEWDOG_REPORTER: github-pr-review
/usr/bin/git rev-parse --show-toplevel
/home/runner/work/**REDACTED**
/usr/bin/git diff --diff-filter=D --name-only be7c6fbeb28d8f9439582d1936aa2a3f269d759a 3ccf5234dc28c9ce4c1b695758a0456acd450489
.github/workflows/dashboard-quality-gate.yml
.github/workflows/homepage-quality-gate.yml
.github/workflows/storybook-quality-gate.yml
.github/workflows/ui-quality-gate.yml
Successfully created paths-output-file: /tmp/dca9856d-2c5c-4432-a6a3-46b49fef9c00.txt
Run bash $GITHUB_ACTION_PATH/entrypoint.sh
changed-files
  Resolving repository path...
  Retrieving changes between be7c6fbeb28d8f9439582d1936aa2a3f269d759a (develop) → 3ccf5234dc28c9ce4c1b695758a0456acd450489 (chore/merge-quality-gate)
  Getting diff...
  Matching changed files: apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx|apps/dashboard/src/common/transforms/parseDate/parseDate.ts|packages/ui/components/NavigationBar/NavigationBar.tsx
  Non Matching changed files: .github/workflows/quality-gate.yml apps/homepage/src/components/organisms/RfpModal/OfficeForm.tsx
  Matching modified files: apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx|apps/dashboard/src/common/transforms/parseDate/parseDate.ts|packages/ui/components/NavigationBar/NavigationBar.tsx
  Non Matching modified files: .github/workflows/dashboard-quality-gate.yml .github/workflows/homepage-quality-gate.yml .github/workflows/quality-gate.yml .github/workflows/storybook-quality-gate.yml .github/workflows/ui-quality-gate.yml apps/homepage/src/components/organisms/RfpModal/OfficeForm.tsx
  Non Matching deleted files: .github/workflows/dashboard-quality-gate.yml .github/workflows/homepage-quality-gate.yml .github/workflows/storybook-quality-gate.yml .github/workflows/ui-quality-gate.yml
  Added files: 
  Copied files: 
  Deleted files: 
  Modified files: apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx apps/dashboard/src/common/transforms/parseDate/parseDate.ts packages/ui/components/NavigationBar/NavigationBar.tsx
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed and modified files: apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx apps/dashboard/src/common/transforms/parseDate/parseDate.ts packages/ui/components/NavigationBar/NavigationBar.tsx
  All changed files: apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx apps/dashboard/src/common/transforms/parseDate/parseDate.ts packages/ui/components/NavigationBar/NavigationBar.tsx
  All modified files: apps/dashboard/src/common/layouts/DashboardLayout/DashboardLayout.stories.tsx apps/dashboard/src/common/transforms/parseDate/parseDate.ts packages/ui/components/NavigationBar/NavigationBar.tsx

Let me just try last time with all packages and apps.

@miszo Thanks the output looks correct, I’ll spend sometime debugging this.