changed-files: [BUG] `files_ignore` isn't respected

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?

I specified files and files_ignore as below.

- name: Get all script files that have changed
  id: changed-files
  uses: tj-actions/changed-files@v37
  with:
    files: |
      assets/scripts/**.sh
      .github/test-microk8s-ubuntu.yml
    files_ignore: assets/scripts/configure-minikube-linux.sh

And the files changed are [assets/scripts/configure-minikube-linux.sh]. But steps.changed-files.outputs.any_modified == 'true' is evaluated as true.

To Reproduce

  1. Action is running on ubuntu-latest
  2. Config
name: test-microk8s-ubuntu

on:
  pull_request:
    branches: [master]
  push:
    branches: [master]

jobs:
  test-linux:
    runs-on: ubuntu-latest

    steps:
      - name: Check out Git repository
        uses: actions/checkout@v3

      - name: Get all script files that have changed
        id: changed-files
        uses: tj-actions/changed-files@v37
        with:
          files: |
            assets/scripts/**.sh
            .github/test-microk8s-ubuntu.yml
          files_ignore: assets/scripts/configure-minikube-linux.sh

      - name: Configure MicroK8s Cluster
        if: ${{ steps.changed-files.outputs.any_modified == 'true' }}
        run: |
        # blah blah
        shell: bash

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

steps.changed-files.outputs.any_modified should be set to false, when only files changed belong to files_ignore.

Relevant log output

No response

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 a year ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

Yes, you are spot on

One small doubt, when a PR is created to dev branch from a feature branch: setting since_last_remote_commit to true gets the changed files from the commit on feature branch and compares with the commit on dev branch right (for the first time)? And for the subsequent commits, it checks using previous commits on the feature branch. Did I understand this correctly?

No worries, was a fun debugging session.

Thank you. Also Apologies for incorrectly filing this as a bug.

For checking the commit you might want to use since_last_remote_commit

      - name: Get all script files that have changed
        id: changed-files
        uses: tj-actions/changed-files@v37
        with:
           since_last_remote_commit: true
           ...

Sure. Thanks a lot for the quick response!

Here’s the log. Didn’t include changed-files as it’s too long. This is the workflow file.

##[debug]Evaluating condition for step: 'Get all script files that have changed'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Get all script files that have changed
##[debug]Loading inputs
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: github.api_url
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'api_url'
##[debug]=> 'https://api.github.com'
##[debug]Result: 'https://api.github.com'
##[debug]Loading env
Run tj-actions/changed-files@v37
  with:
    files: assets/scripts/**.sh
  .github/test-microk8s-ubuntu.yml
  
    files_ignore: assets/scripts/configure-minikube-linux.sh
    separator:  
    include_all_old_new_renamed_files: false
    old_new_separator: ,
    old_new_files_separator:  
    files_from_source_file_separator: 
  
    files_separator: 
  
    files_yaml_from_source_file_separator: 
  
    files_ignore_yaml_from_source_file_separator: 
  
    files_ignore_separator: 
  
    files_ignore_from_source_file_separator: 
  
    path: .
    quotepath: true
    diff_relative: true
    dir_names: false
    dir_names_exclude_current_dir: false
    json: false
    escape_json: true
    fetch_depth: 50
    skip_initial_fetch: false
    since_last_remote_commit: false
    write_output_files: false
    output_dir: .github/outputs
    output_renamed_files_as_deleted_and_added: false
    recover_deleted_files: false
    recover_files_separator: 
  
    recover_files_ignore_separator: 
  
    token: ***
    api_url: https://api.github.com
::group::changed-files
changed-files
::group::changed-files-patterns
changed-files-patterns
  ##[debug]All filtered diff files: {"A":[],"C":[],"D":[],"M":["assets/scripts/configure-microk8s-linux.sh"],"R":[],"T":[],"U":[],"X":[]}
  ##[debug]Added files: {"paths":"","count":"0"}
  ##[debug]Copied files: {"paths":"","count":"0"}
  ##[debug]Modified files: {"paths":"assets/scripts/configure-microk8s-linux.sh","count":"1"}
  ##[debug]Renamed files: {"paths":"","count":"0"}
  ##[debug]Type changed files: {"paths":"","count":"0"}
  ##[debug]Unmerged files: {"paths":"","count":"0"}
  ##[debug]Unknown files: {"paths":"","count":"0"}
  ##[debug]All changed and modified files: {"paths":"assets/scripts/configure-microk8s-linux.sh","count":"1"}
  ##[debug]All changed files: {"paths":"assets/scripts/configure-microk8s-linux.sh","count":"1"}
  ##[debug]All other changed files: {"paths":".github/workflows/test-microk8s-ubuntu.yml .github/workflows/test-minikube-ubuntu.yml assets/scripts/configure-microk8s-linux.sh assets/scripts/configure-minikube-linux.sh","count":"4"}
  ##[debug]All modified files: {"paths":"assets/scripts/configure-microk8s-linux.sh","count":"1"}
  ##[debug]Deleted files: {"paths":"","count":"0"}
  All Done!
  ::endgroup::
##[debug]Node Action run completed with exit code 0
##[debug]Set output added_files = 
##[debug]Set output added_files_count = 0
##[debug]Set output copied_files = 
##[debug]Set output copied_files_count = 0
##[debug]Set output modified_files = assets/scripts/configure-microk8s-linux.sh
##[debug]Set output modified_files_count = 1
##[debug]Set output renamed_files = 
##[debug]Set output renamed_files_count = 0
##[debug]Set output type_changed_files = 
##[debug]Set output type_changed_files_count = 0
##[debug]Set output unmerged_files = 
##[debug]Set output unmerged_files_count = 0
##[debug]Set output unknown_files = 
##[debug]Set output unknown_files_count = 0
##[debug]Set output all_changed_and_modified_files = assets/scripts/configure-microk8s-linux.sh
##[debug]Set output all_changed_and_modified_files_count = 1
##[debug]Set output all_changed_files = assets/scripts/configure-microk8s-linux.sh
##[debug]Set output all_changed_files_count = 1
##[debug]Set output any_changed = true
##[debug]Set output only_changed = false
##[debug]Set output other_changed_files = .github/workflows/test-microk8s-ubuntu.yml .github/workflows/test-minikube-ubuntu.yml assets/scripts/configure-minikube-linux.sh
##[debug]Set output other_changed_files_count = 3
##[debug]Set output all_modified_files = assets/scripts/configure-microk8s-linux.sh
##[debug]Set output all_modified_files_count = 1
##[debug]Set output any_modified = true
##[debug]Set output only_modified = false
##[debug]Set output other_modified_files = .github/workflows/test-microk8s-ubuntu.yml .github/workflows/test-minikube-ubuntu.yml assets/scripts/configure-minikube-linux.sh
##[debug]Set output other_modified_files_count = 3
##[debug]Set output deleted_files = 
##[debug]Set output deleted_files_count = 0
##[debug]Set output any_deleted = false
##[debug]Set output only_deleted = false
##[debug]Set output other_deleted_files = 
##[debug]Set output other_deleted_files_count = 0
##[debug]Finishing: Get all script files that have changed