Git Product home page Git Product logo

changed-files's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

changed-files's Issues

[BUG] Failed to get change files on pull_request merge event

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?

We use changed-files in one of our github workflows. It's basically triggered on pull_request merge. Snippet of code:

on:
  pull_request:
    types: [closed]
    paths:
      - 'abc/def/**'

jobs:
  Publish-Pipelines:
    if: github.event.pull_request.merged == true
......

However, in one of our PR merge event, I found the workflow failed with following info:

changed-files
  Resolving repository path...
  Setting up 'temp_changed_files' remote...
  No 'temp_changed_files' remote found
  Creating 'temp_changed_files' remote...
  Getting HEAD info...
  remote: Enumerating objects: 23, done.        
  remote: Counting objects:   4% (1/23)        
  remote: Counting objects:   8% (2/23)        
  remote: Counting objects:  13% (3/23)        
  remote: Counting objects:  17% (4/23)        
  remote: Counting objects:  21% (5/23)        
  remote: Counting objects:  26% (6/23)        
  remote: Counting objects:  30% (7/23)        
  remote: Counting objects:  34% (8/23)        
  remote: Counting objects:  39% (9/23)        
  remote: Counting objects:  43% (10/23)        
  remote: Counting objects:  47% (11/23)        
  remote: Counting objects:  52% (12/23)        
  remote: Counting objects:  56% (13/23)        
  remote: Counting objects:  60% (14/23)        
  remote: Counting objects:  65% (15/23)        
  remote: Counting objects:  69% (16/23)        
  remote: Counting objects:  73% (17/23)        
  remote: Counting objects:  78% (18/23)        
  remote: Counting objects:  82% (19/23)        
  remote: Counting objects:  86% (20/23)        
  remote: Counting objects:  91% (21/23)        
  remote: Counting objects:  95% (22/23)        
  remote: Counting objects: 100% (23/23)        
  remote: Counting objects: 100% (23/23), done.        
  remote: Compressing objects:  25% (1/4)        
  remote: Compressing objects:  50% (2/4)        
  remote: Compressing objects:  75% (3/4)        
  remote: Compressing objects: 100% (4/4)        
  remote: Compressing objects: 100% (4/4), done.        
  remote: Total 12 (delta 8), reused 9 (delta 6), pack-reused 0        
  From https://github.com/instacart/carrot
   ! [rejected]            master     -> master  (non-fast-forward)
   * [new branch]          master     -> temp_changed_files/master
  Error: Process completed with exit code 1.

I am wondering what may be the issue? The only thing I can think of is that, the PR was uploaded 8 days ago and merged today, which was the long time span. Would that cause any issue?

To Reproduce

See bug description

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

Workflow should go through

Relevant log output

No response

Anything else?

No response

Code of Conduct

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

[Feature] Rename `all_changed_files` to `all_changed_and_modified_files`

Is your feature request related to a problem? Please describe.

There’s no clear distinction between the term changed and modified

Describe the solution you'd like?

To make a clear distinction between changed files and modified files the current all_changed_files needs to be renamed to all changed and modified files

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

[BUG] any_changed reports true without matching changed files

Describe the bug
When testing for changes in specific file types the any_changed output is true while it should be false.

To Reproduce
Steps to reproduce the behavior:

  1. Add the following to a yml file
- name: Get specific changed files
   id: specific_changed_files
   uses: tj-actions/changed-files@v6
   with:
      files: |
        .(php|css|js|vue)$
- name: Run step if any of the listed files above change
   if: steps.specific_changed_files.outputs.any_changed == 'true'
   run: |
      echo "One or more files listed above has changed."
  1. Commit to GitHub without changing any of the match file types.

Expected behavior
echo "One or more files listed above has changed." should not run since no files are changed as can be seen in the screenshot.

Screenshots
Screenshot 2021-05-16 at 18 43 25

[BUG] `all_modified_files` show deleted files

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

Hi everyone,
First of all thank you for this action , It is really helpful!
As I understood right documentation all_modified_files - showing only ACMR

Select all modified filesi.e. a combination of all added,copied, modified and renamed files (ACMR).

But , when I deleted directory with files it show as all_modified_files. In my opinion It's wrong behaviour.

(Plz correct me if I wrong)

To Reproduce

  1. Created some branch in repo.
  2. Added two directory: first test_pipeline and nested directory new and few .yaml files inside new directory .
  3. Ran workflow and all_modified_files -show me everything correct.
  4. Deleted directory new
  5. Ran workflow again and saw all deleted files.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

Don’t output deleted files

Relevant log output

Retrieving changes between 1bfe9ff893a8625996ba04b052cdf89e1e683520 (test-gha-custom-label) → 40ea730b3389a39578a9eeba23c1eda181dfb894 (test-gha-custom-label)
  Checking for file changes: ".(yaml)$"...
  Checking for file changes: "test-pipeline"...
  Added files: 
  Copied files: 
  Deleted files: test-pipeline/new/asaaa.yaml test-pipeline/new/go.yaml
  Modified files: .github/workflows/test-label.yaml
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed files: .github/workflows/test-label.yaml test-pipeline/new/asaaa.yaml test-pipeline/new/go.yaml
  All modified files: .github/workflows/test-label.yaml test-pipeline/new/asaaa.yaml test-pipeline/new/go.yaml
  Input files: .(yaml)$ test-pipeline
  Matching modified files: .github/workflows/test-label.yaml test-pipeline/new/asaaa.yaml test-pipeline/new/go.yaml

Anything else?

# my config
- name: Get changed files
        id: changed-files
        uses: tj-actions/[email protected]
        with:
          files: |
             .(yaml)$
             test-pipeline

Code of Conduct

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

Can't get `since_last_remote_commit` to work properly on pull_request event

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

If I am not mistaken since_last_remote_commit option compares all changes between the last commit available in remote.
When using the next step:

- name: Check changes
        id: changed-files
        uses: tj-actions/[email protected]
        with:
          # fetch-depth: 0
          since_last_remote_commit: 'true'

I get the following result: README.md iv.yaml package.json
I am changing only the github action file between pushes, how is it possible?. What am I missing?.

Describe the solution you'd like?

Explanation of current behabior

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

support windows-latest

Is your feature request related to a problem? Please describe.
uh yes, when i use this workflow in windows-latest env, it cause a error:

Run tj-actions/changed-files@v7
  with:
    token: ***
    separator:  
Error: Container action is only supported on Linux

And that is because i should run my C++ workflow in win to use msvc, and i want to use change-file together

Describe the solution you'd like
Add win support

[BUG] changed-files unable to initialize git repository on custom container image

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

when using a custom container image on ubuntu-latest, changed-files is unable to initialize a the git repository

  fatal: not a git repository (or any parent up to mount point /)
  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  Error: Process completed with exit code 128.

To Reproduce

consider this action --

  quality-checks:
    runs-on: ubuntu-latest
    container:
      image: 123456789.dkr.ecr.us-west-2.amazonaws.com/my-test-container:latest
      credentials:
        username: AWS
        password: saved-password
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 2
      - name: Get changed files
        id: changed-files-specific
        uses: tj-actions/[email protected]
        with:
          files: |
            /__w/my-test-container/my-test-container/*.py

during the Initialize containers step i see it create my container with a working directory--

  /usr/bin/docker create --name 123456789amazonawscommytestcontainerklatest_91g223 --label c9e036 --workdir /__w/my-test-container/my-test-container 

then during the actions/checkout it wipes the correct working dir and checks out the code --

Syncing repository: MyRepo/my-test-container
Getting Git version info
Deleting the contents of '/__w/my-test-container/my-test-container'
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Downloading the archive
Writing archive to disk
Extracting the archive

then changed-files seems to fail when getting the HEAD info --

Run tj-actions/[email protected]
changed-files
  fatal: not a git repository (or any parent up to mount point /)
  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  Error: Process completed with exit code 128.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

is there a way to configure where changed-files looks for the git repo? in this case it should initialize in /__w/my-test-container/my-test-container/

does it need this working-directory option? https://github.community/t/use-working-directory-for-entire-job/16747/2
(seems like this would need some tweaks to the checkout action to allow it to check out to a different directory.

Relevant log output

No response

Anything else?

possible dupe of #100

Code of Conduct

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

[BUG] Error: xargs: unmatched single quote

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

I get the following error sometimes:

xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option

To Reproduce

I haven't had time to try to reproduce it locally. I'm first posting here to check if this is a known issue or if someone else already had it before I spend more time troubleshooting it (I'm a bash novice).

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

There should be no errors.

Relevant log output

Run tj-actions/changed-files@2f8c46f9d79d979656108f4fc4414c378ee4abed
  with:
    files: ^transform/snowflake-dbt/.*
  
    base_sha: 01f529cacb2dff32b9a54cf946dce1c74c039a5a
    sha: c6e8af0e7208d28653aab87352c9d5f81cc7742b
    token: ***
    separator:  
  env:
    SNOWSQL_ACCOUNT: ***
    SNOWSQL_USER: ***
    SNOWSQL_PWD: ***
    SNOWSQL_WAREHOUSE: dbt_ci_wh
changed-files
  Getting HEAD info...
  From https://github.com/voiapp/data-pipelines
   * [new branch]        master     -> master
   * [new branch]        master     -> origin/master
  Retrieving changes between 01f529cacb2dff32b9a54cf946dce1c74c039a5a (master) → c6e8af0e7208d28653aab87352c9d5f81cc7742b (backfill_MRS_vehicle_not_available)
  Checking for file changes: "^transform/snowflake-dbt/.*"...
  Added files: 
  Copied files: 
  Deleted files: 
  Modified files: transform/snowflake-dbt/models/analytics/magic_ride_session.sql transform/snowflake-dbt/models/model/engineering/user_experience/start_ride_attempt.sql
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed files: transform/snowflake-dbt/models/analytics/magic_ride_session.sql transform/snowflake-dbt/models/model/engineering/user_experience/start_ride_attempt.sql
  All modified files: transform/snowflake-dbt/models/analytics/magic_ride_session.sql transform/snowflake-dbt/models/model/engineering/user_experience/start_ride_attempt.sql
  xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
  Error: Process completed with exit code 1.

Anything else?

Great project, thanks for maintaining it! Very useful.

For security reasons, I have to hardcode the commit SHAs of external GitHub Actions. The one I'm using for this report is 2f8c46f, which is the equivalent of v9.3.

Screenshot of the error: image

Code of Conduct

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

[BUG] Spaces in file names are not handled correctly

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

If you have spaces in your file names and you provide a custom separator (eg. separator: ",") all spaces are replaced by the separator and the results sorted.

To Reproduce

  1. On a repo containing the paths:
  • embeds/general 412874536418279426/read-me-1 899830563651854336.json
  • Test 1/Test 1.json
  1. Running
- id: json_changes
  uses: tj-actions/[email protected]
  with:
      files: |
        .json$
      separator: ","

- name: List modified files
  run: |
    echo ${{ steps.json_changes.outputs.all_modified_files }}
  1. Sees the result of:
    1.json,1/Test,412874536418279426/read-me-1,899830563651854336.json,Test,embeds/general

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

I expect:
embeds/general 412874536418279426/read-me-1 899830563651854336.json,Test 2/Test 1.json

Relevant log output

No response

Anything else?

No response

Code of Conduct

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

[Feature] Rename `files` -> `paths` [#tara-label-enhancement] [#tara-label-good first issue]

Is your feature request related to a problem? Please describe.

Given that both files and directories can be added using the files input which seems limited to describing files.

Describe the solution you'd like?

Proposed change here would be renaming files to paths which is more generic and can describe both file based paths and directories.

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

[BUG] pull request with `since_last_remote_commit = true` returns fatal: bad object

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 action is not able to locate the last remote commit on the pull-request.

To Reproduce

Here is the action YAML:

    steps:
      - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
        with:
          ref: "${{ github.event.pull_request.head.sha }}"
      - id: changed-files
        uses: tj-actions/changed-files@aae164d51be780a235cdeea89752bbacbbfee3c3
        with:
          files: |
            ^${{ env.PROJECT_PATH }}
          sha: "${{ github.event.pull_request.head.sha }}"
          since_last_remote_commit: "true"

When this workflow is executed, it results in several fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3 errors, and all outputs are blank. That commit SHA is correct -- it was the last remote commit on the pull-request branch. It also returns the correct commit SHA if there are multiple commits pushed at the same time.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

I expect the action to provide a diff of files between the last remote commit on the pull-request (which it correctly figures out) and the HEAD commit of the pull-request (the last commit that was pushed -- which I have confirmed in the output is also correct). Perhaps the base ref needs to be explicitly fetched from the remote in order for it to be found.

Relevant log output

Run tj-actions/changed-files@aae164d51be780a235cdeea89752bbacbbfee3c3
  with:
    files: ^libraries/terraform/name-provider
    since_last_remote_commit: true
    token: ***
    separator:  
    sha: e42496235d245861a95249a5c04c06d3907f19a0
  env:
    PROJECT_NAME: terraform-name-provider
    PROJECT_PATH: libraries/terraform/name-provider
Run bash $GITHUB_ACTION_PATH/sourcefiles.sh
  bash $GITHUB_ACTION_PATH/sourcefiles.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    PROJECT_NAME: terraform-name-provider
    PROJECT_PATH: libraries/terraform/name-provider
    INPUT_FILES: ^libraries/terraform/name-provider
    INPUT_FILES_FROM_SOURCE_FILE: 
changed-files-from-source-file
  Input Files: ^libraries/terraform/name-provider
  All Unique Input files: ^libraries/terraform/name-provider
Run if [[ -n "" ]]; then
  if [[ -n "" ]]; then
    echo "::set-output name=base_sha::"
  elif [[ "true" == "true" && -z "" ]]; then
    echo "::set-output name=base_sha::9b20d537dc9a0943ad43cd8e6a08c444640a75e3"
  fi
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    PROJECT_NAME: terraform-name-provider
    PROJECT_PATH: libraries/terraform/name-provider
Run bash $GITHUB_ACTION_PATH/entrypoint.sh
  bash $GITHUB_ACTION_PATH/entrypoint.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    PROJECT_NAME: terraform-name-provider
    PROJECT_PATH: libraries/terraform/name-provider
    GITHUB_SERVER_URL: https://github.com
    GITHUB_REPOSITORY: [REDACTED]
    GITHUB_BASE_REF: master
    INPUT_SHA: e42496235d245861a95249a5c04c06d3907f19a0
    INPUT_BASE_SHA: 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
    INPUT_TOKEN: ***
    INPUT_FILES: ^libraries/terraform/name-provider
    INPUT_SEPARATOR:  
    INPUT_PATH: 
changed-files
  Resolving repository path...
  Setting up 'temp_changed_files' remote...
  No 'temp_changed_files' remote found
  Creating 'temp_changed_files' remote...
  Getting HEAD info...
  From https://github.com/[REDACTED]
   * [new branch]          master     -> master
   * [new branch]          master     -> temp_changed_files/master
  Retrieving changes between 9b20d537dc9a0943ad43cd8e6a08c444640a75e3 (master) → e42496235d245861a95249a5c04c06d3907f19a0 ([REDACTED])
  Input files: ^libraries/terraform/name-provider
  Checking for file changes: "^libraries/terraform/name-provider"...
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  Matching modified files: 
  fatal: bad object 9b20d537dc9a0943ad43cd8e6a08c444640a75e3
  Matching deleted files: 
  Added files: 
  Copied files: 
  Deleted files: 
  Modified files: 
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed files: 
  All modified files:

Anything else?

As an aside, this logging can be misleading:

Retrieving changes between X (master) → Y (branch)

Since the X commit may not be from master.

Code of Conduct

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

[BUG] Dedupe the output list of changed files

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

There's a possibility of returning the same file twice when it matches one or more regex used in the files input.

To Reproduce

  1. Create a .github/workflows/test.yml
  2. Enter the following
  uses: tj-actions/changed-files@v9
  with:
    files: |
		path-to-files
	    .(js|ts|tsx|scss)$
  ...

What OS are you seeing the problem on?

all

Expected behavior?

The list of changed files returned shouldn't be duplicated.

Relevant log output

All changed files: path-to-files/test.js path-to-files/test.js

Anything else?

No response

Code of Conduct

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

[Feature] any_changed doesn't capture changes due to deleting files

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

I would expect any_changed to be true when there is a deleted file. It looks like any changed doesn't take deleted files into account.

To Reproduce

Delete a file in the specified directory and then check the any_changed flag.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

If there is anything listed for "All changed files" that the any_changed flag would be true.

Relevant log output

Checking for file changes: "automated-testing-gaps.md"...  
  Checking for file changes: "AutomatedTests"...
  Added files: 
  Copied files: 
  Deleted files: AutomatedTests/SettingsMonitorTests.swift
  Modified files: 
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed files: ffm/AutomatedTests/SettingsMonitorTests.swift
  All modified files: 
  Input files: automated-testing-gaps.md AutomatedTests
  Matching modified files: 
  Non Matching modified files: UserPreferences.m AppDelegate.m

Anything else?

No response

Code of Conduct

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

Feature request

Is it possible to add support for push commits?
i think it would be even more useful

Rename changed_files -> type_changed_files

Is your feature request related to a problem? Please describe.
Clean up tasks. which should resolve any confusion with changed vs modified.

Describe the solution you'd like
All references to changed_files are modified to type_changed_files.

[Feature] Documentation for difference between all_changed_files and all_modified_files

Is your feature request related to a problem? Please describe.

I can't tell the difference between all_changed_files and all_modified_files.

Describe the solution you'd like?

I would love it if the two were clearly distinguished in the documentation.

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

Add support for watching a subset of files.

Is your feature request related to a problem? Please describe.
Add support for checking a subset of files that have changed relative to the default branch.

   - name: Get all changed files
     id: changed_files
     uses: ...
     with:
       files: ...

   - name: Run step
     if: steps.changed_files.outputs == 'true'

[BUG] <any_changed doesn't capture changes due to renaming files>

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

I would expect any_changed to be true when there is a renamed file. It looks like any changed doesn't take renamed files into account.

To Reproduce

Rename a file in the specified directory and then check the any_changed flag.
Screen Shot 2021-07-23 at 4 04 42 PM

For the specific case when I came across this, the file was renamed (moved from a directory outside the one specified into the specified AutomatedTests directory) but also had additional changes. It only showed up in the renamed files list.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

If there is anything listed for "All changed files" that the any_changed flag would be true.

Relevant log output

Checking for file changes: "AutomatedTests"...
  Added files: 
  Copied files: 
  Deleted files: 
  Modified files: 
  Renamed files: AutomatedTests/DownloadDatabaseTestCase.swift
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed files: AutomatedTests/DownloadDatabaseTestCase.swift
  All modified files: 
  Input files: AutomatedTests
  Matching modified files:

Anything else?

No response

Code of Conduct

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

[Feature] Support the same filter syntax as GitHub Workflows

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

This action would be more intuitive and easier to use if it supported the same file filtering syntax as GitHub Workflows support natively. I realize the reason it does not is because it's easier to just accept the input that is used natively by the underlying bash commands. But I'm curious if this is something that could eventually be implemented.

Describe the solution you'd like?

Use syntax like foo/**/bar instead of ^foo/.*/bar, or **/*.md instead of or \.md$. Exclusion rules could either be supported with ! rules, or in a separate input (e.g. exclude-files).

Describe alternatives you've considered?

No response

Anything else?

https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet

Code of Conduct

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

Setting remote URL breaks other steps that are using it

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

It seems that:
git remote set-url origin "https://${INPUT_TOKEN}@github.com/${GITHUB_REPOSITORY}"
is permanently breaking the next steps we have in the workflow that depends on it.

After executing the script origin should be set to it's original value instead of keeping it with INPUT_TOKEN

To Reproduce

  1. Add changed-file step
  2. Check in next step that origin is permanently modified which may break other scripts.

What OS are you seeing the problem on?

all

Expected behavior?

I would expect to not have modified origin at the end of script execution

Relevant log output

Our other scripts depend on git origin string comparison for security reasons, having token forced is making them fail.

Anything else?

I work around that issue by adding extra step that is resetting changes:

- name: Fix get changed files origin
        run: |
          git remote set-url origin "https://github.com/${GITHUB_REPOSITORY}"

Code of Conduct

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

[Feature] Specify sed delimiter or escaping forward slashes used in separator

Is your feature request related to a problem? Please describe.

When using a separator containing a forward slash, sed interprets it as a delimiter, leading to errors such as

Checking for file changes: ...
sed: -e expression #1, char 9: unknown option to `s'

https://github.com/tj-actions/changed-files/blob/main/entrypoint.sh#L118-L136

Describe the solution you'd like?

Either an option to choose the delimiter with a default to /, e.g. setting SED_DELIMITER=@ would turn the sed commands into sed 's@ *@'"$INPUT_SEPARATOR"'@g' and / would not be interpreted as a delimiter.
or
Escaping forward slashes used in separator.

The latter may reduce the number of initial errors or confusion more than the former.

Describe alternatives you've considered?

Escaping forward slashes works fine for short separators, e.g. \/ but becomes onerous when using unixy paths, web addresses, etc.

Anything else?

No response

Code of Conduct

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

Improve test coverage

  • Setup a test folder
  • Support testing added files
  • Support testing copied files
  • Support testing modified files
  • Support testing deleted files
  • Support testing renamed files
  • Support testing files with their type changed
  • Support testing unmerged files
  • Support testing unknown files

Should the Major Issue Version Point to the Latest Minor?

Is your feature request related to a problem? Please describe.
I am looking for a way to use the latest version of a specific major version in my pipeline. I would like to use the latest v5 version but comparing the latest commit hashes of v5.3 and v5, I see that these currently does not match.

Describe the solution you'd like
It would be helpful if we can specify tj-actions/changed-files@v5 or tj-actions/[email protected] to mean to use latest v5 branch.

Describe alternatives you've considered
I am currently using tj-actions/changed-files@v5 in my action and only hope it gets pointed to the latest release.

Additional context
None

[BUG] Deleted files not detected

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

I am using the action as follows, but when I delete files in "mydir", they are not appearing in the summary.
e.g. I delete mydir/hello.txt
The deleted file is missing from the list "Checking for file changes" and "Deleted files:"
This happens every time.

To Reproduce

    steps:
      - name: Get latest code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Get changed files
        id: changed-files
        uses: tj-actions/[email protected]
        with:
          files: |
            mydir/**

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

Deleted files should list the files that were deleted.

Relevant log output

Run tj-actions/[email protected]
  with:
    files: mydir/**
  
    token: ***
    separator:  
    sha: XXXXX
  env:
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
    AWS_S3_BUCKET: ***
    AWS_REGION: ***
changed-files
  Getting HEAD info...
  Retrieving changes between XXX (master) → XXXX (master)
  Checking for file changes: "mydir/d"...
  Checking for file changes: "mydir/gulpfile.js"...
  Checking for file changes: "mydir/images"...
  Checking for file changes: "mydir/slider"...
  Checking for file changes: "mydir/style"...
  Added files: 
  Copied files: 
  Deleted files: 
  Modified files: 
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed files: 
  All modified files: 
  Input files: mydir/**
  Matching modified files: 
  Non Matching modified files: .github/workflows/main.yml

Anything else?

No response

Code of Conduct

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

[BUG] Changed files not working on self hosted runners

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?

Not working on self hosted github runners.

To Reproduce

  1. Have a self hosted github runner.
  2. Run this action as part of a workflow more than 2 times.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

Action should work on self hosted github runners.

Relevant log output

error: remote temp_changed_files already exists.


### Anything else?

This is most likely because the script adds a new origin to calculate the changed files.
In the self hosted runner, the state is maintained and the subsequent builds run into the issue of where the required git origin is already added.

I think a check can be added to see if this already exists.

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

[BUG] not able to find only python 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?

  • name: Get specific changed files
    id: changed-files
    uses: tj-actions/changed-files@v11
    with:
    files: |
    .py

i want only python files to be captured and using above format which doesnt work and giving below error.

fatal: bad object

To Reproduce

  • name: Get specific changed files
    id: changed-files
    uses: tj-actions/changed-files@v11
    with:
    files: |
    .py

i want only python files to be captured and using above format which doesnt work and giving below error.

fatal: bad object

What OS are you seeing the problem on?

ubuntu-18.04

Expected behavior?

only python files should come in the output

Relevant log output

No response

Anything else?

No response

Code of Conduct

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

[Feature] Get changed files in all commits in push

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

The current action seems to just find changed files in the last commit. If a push includes multiple commits, then changed files in all but the last commit will be ignored.

Describe the solution you'd like?

The ability to list all changed files in all commits in a push that triggers the action.

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

[BUG] Usage of quotes around array items

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

Based on the documentation using "${ARRAY}" and looping over the items results in a single item instead of looping over each item in an array.

To Reproduce

ARRAY=(a b c d)

for i in "${ARRAY}"
   echo i

This prints out:

a b c d

as opposed to:

a
b
c
d

What OS are you seeing the problem on?

all

Expected behavior?

a
b
c
d

Relevant log output

No response

Anything else?

No response

Code of Conduct

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

[Feature] Get Changed files since last successful Action run

Is your feature request related to a problem? Please describe.

Im trying to find changes not since the last commit on main branch, but since the last commit on main branch with a successful action run.

I found this handy action: https://github.com/nrwl/last-successful-commit-action
but I find no way to define which commit to compare to.
I did find the sha config variable, but apparently that is to say "what is the current" commit. Not what is the target commit to compare to.

Describe the solution you'd like?

Perhaps a target_sha setting?

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

[Feature] Get specific changed files reading a file

Is your feature request related to a problem? Please describe.

Hi guys!
I have a Step with a lot of entries in files: input and those entries often change. Since I already have an existing file with all files that could change (one for line), is there the possibility to provide this specific file to read from?

Describe the solution you'd like?

An example of implementation:

source file files-list.txt:

my-file.txt
test.txt
new.txt
test_directory
.(png|jpeg)$   
.(sql)$
^(mynewfile|custom)

Action step:

- name: Get specific changed files from a file
  id: changed-files-specific
  uses: tj-actions/[email protected]
  with:
    read-from-file: files-list.txt

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

[Feature] Improve documentation

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

The examples are hard to follow and understand

Describe the solution you'd like?

I'll like a more detailed example that highlights each use case.

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

fatal error when using @v4.2

Describe the bug
I get the following:

Run tj-actions/[email protected]
Getting head sha...
fatal: ambiguous argument 'HEAD^1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Getting diff...
fatal: ambiguous argument 'HEAD^1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Error: Process completed with exit code 128.

To Reproduce
My template:

      - name: Get modified files using defaults
        id: changed-files
        uses: tj-actions/[email protected]

Expected behavior
That the system would get a list of changed files

Additional context
using ubuntu-latest

[BUG] Glob vs regex in readme and execution when using * in with: files:

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

The readme currently contains:

      - name: Get specific changed files
        id: changed-files-specific
        uses: tj-actions/[email protected]
        with:
          files: |
            my-file.txt
            test.txt
            new.txt
            test_directory
            *.sh
            .(png|jpeg)$
            .(sql)$
            ^(mynewfile|custom)

These examples are utilizing behavior undefined in the ERE

The asterisk, plus-sign, question-mark, and left-brace shall be special except when used in a bracket expression (see RE Bracket Expression). Any of the following uses produce undefined results:
If these characters appear first in an ERE, or immediately following an unescaped vertical-line, circumflex, dollar-sign, or left-parenthesis

GNU Grep allows them to be a part of EREs, but this can cause issues when it's used by other parts of the entrypoint script.

To Reproduce

Given a directory structure such as

├── directory
│   └── child_dir.sh
└── root_dir.sh

and an action such as

      - name: get changed files
        id: changed_files
        uses: tj-actions/[email protected]
        with:
          files: |
            *.sh

output shows *.sh gets expanded by the bash entrypoint script as a glob:

[...]
Checking for file changes: "root_dir.sh"...
[...]
Matching modified files: 
Non Matching modified files:  root_dir.sh directory/child_dir.sh

as opposed to the expected

[...]
  Checking for file changes: "*.sh"...
[...]
Matching modified files: root_dir.sh directory/child_dir.sh
Non Matching modified files:

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

If *.sh is in the examples, it should work to find any files with .sh in them. If not, it should be removed from the examples along with .

Variables with expected special characters should be quoted to prevent globbing when using them in output.

Relevant log output

No response

Anything else?

For the *.sh example, .*\.sh works as a replacement.

https://www.gnu.org/software/grep/manual/html_node/Basic-vs-Extended.html

Code of Conduct

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

[Feature] Make it easier to exclude files

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

Right now files can be used to easily match files, essentially an "allow" list. For example, you can match any file which begins with a path, like ^path/to/directory. However, it's not easy to exclude files. For example, if I wanted to match on all files in the path/to/directory except files which end with .md.

Describe the solution you'd like?

It may be easiest to accept another input, such as exclude-files, which will simply be negated versions of the provided GREP regular expressions. For example, to exclude all files ending with .md you could do exclude-files: \.md$

Describe alternatives you've considered?

See also: #264 -- which if implemented could invalidate this ticket.

Anything else?

No response

Code of Conduct

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

[Feature] fetch HEAD without tags

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

Using this on a monorepo with a lot of tags, it will cause minor slowness and more output over time (there are already hundreds of tags).

Describe the solution you'd like?

Tags don't seem to be necessary, so fetching can most likely be performed with --no-tags.

https://github.com/tj-actions/changed-files/blob/main/entrypoint.sh#L52

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

[Feature] Add support for `any_deleted` and `only_deleted` boolean output.

Is your feature request related to a problem? Please describe.

The current changed file detection via only_deleted and any_deleted doesn't include deleted files which makes it tough to detect files that were deleted.

Describe the solution you'd like?

Proposes Solution

Adding two new boolean outputs should help with detecting file deletion.

      - name: Run step when any listed file has been deleted
        if: steps.changed-files.outputs.any_deleted == "true"
        run: |
          for file in "${{ steps.changed-files.outputs.deleted_files }}"; do
            echo "$file was deleted"
          done

      - name: Run step when all listed files have been deleted
        if: steps.changed-files.outputs.only_deleted == "true"
        run: |
          for file in "${{ steps.changed-files.outputs.deleted_files }}"; do
            echo "$file was deleted"
          done

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

[BUG] in entrypoint is referring to gihub.com repository

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug?

This line in entrypoint.sh is adding temporary remote
git remote add temp_changed_files "https://${INPUT_TOKEN}@github.com/${GITHUB_REPOSITORY}"
This is not correct for enterprise github servicer has name like github.enterprise.com and therefore this code does not work and it is trying to access some gihub.com repository which does not exist

To Reproduce

none

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

set correct url as remote

Relevant log output

No response

Anything else?

we are using selfhosted runners

Code of Conduct

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

[Feature] Improve error handling of non local commit reference

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

When using this action errors from non existing commits don’t result in a failure.

See: #253

Describe the solution you'd like?

Any commit that doesn’t exist locally warns the users with a possible resolution

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

[BUG] When running in a workflow generated by a dependabot BUMP PR, the action fails

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?

When dependabot creates a PR to bump a package, calls to this action results in one of two errors

  Resolving repository path...
  Setting up 'temp_changed_files' remote...
  No 'temp_changed_files' remote found
  Creating 'temp_changed_files' remote...
  error: remote temp_changed_files already exists.
  Error: Process completed with exit code 3.

or

 Resolving repository path...
 Setting up 'temp_changed_files' remote...
 No 'temp_changed_files' remote found
 Creating 'temp_changed_files' remote...
 Getting HEAD info...
 fatal: could not read Password for 'https://***@github.com': No such device or address
 Error: Process completed with exit code 128.

To Reproduce

Simply create a workflow that triggers on Pull Requests and uses tj-actions/[email protected]

If dependabot creates the PR, then the action fails.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

Should work just the same as if a normal user created a PR

Relevant log output

See above

Anything else?

No response

Code of Conduct

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

[Feature] Add "any_modified", "other_modified_files" and "all_modified" outputs containing created, edit, renamed, or deleted files

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

In order to test for changes of any kind (create, edit, rename, delete), a combination of 2 conditions is required, like:

if: ${{ steps.changed-files-specific.outputs.any_changed == 'true' || steps.changed-files-specific.outputs.any_deleted == 'true' }}

This works well, but it's a bit too long and could be simplified into a single expression.

Describe the solution you'd like?

If possible, add 2 new outputs any_touched or all_touched which let the user check for any type of modification to the repository contents. Something like:

if: ${{ steps.changed-files-specific.outputs.any_touched == 'true' }}

Describe alternatives you've considered?

Using two conditions with an OR operator, as described in the beginning.

Anything else?

Gitlab CI's only:changes clause behaves similarly to what I'm requesting.

An example of why these variables might be useful is when running test jobs. If the commit only has changes to the README, test jobs could be skipped since no .py files were touched.

Code of Conduct

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

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/codacy-analysis.yml
  • actions/checkout v4
  • codacy/codacy-analysis-cli-action v4.4.1
  • github/codeql-action v3
.github/workflows/codeql.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/greetings.yml
  • actions/first-interaction v1
.github/workflows/issue-comment-job-example.yml
  • actions/checkout v4
  • actions/checkout v4
.github/workflows/manual-triggered-job-example.yml
  • actions/checkout v4
.github/workflows/matrix-example.yml
  • actions/checkout v4
  • actions/checkout v4
.github/workflows/multi-job-example.yml
  • actions/checkout v4
  • actions/checkout v4
.github/workflows/sync-release-version.yml
  • actions/checkout v4
  • tj-actions/release-tagger v4
  • tj-actions/sync-release-version v13
  • tj-actions/sync-release-version v13
  • tj-actions/git-cliff v1
  • peter-evans/create-pull-request v6.1.0
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-node v4.0.2
  • tj-actions/eslint-changed-files v25
  • tj-actions/verify-changed-files v20
  • actions/upload-artifact v4
  • codacy/codacy-coverage-reporter-action v1
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • tj-actions/branch-names v8
  • nrwl/nx-set-shas v4
.github/workflows/update-readme.yml
  • actions/checkout v4
  • tj-actions/auto-doc v3
  • tj-actions/remark v3
  • tj-actions/verify-changed-files v20
  • peter-evans/create-pull-request v6
.github/workflows/workflow-run-example.yml
  • actions/checkout v4
  • actions/checkout v4
npm
package.json
  • @actions/core ^1.10.0
  • @actions/exec ^1.1.1
  • @actions/github ^6.0.0
  • @octokit/rest ^21.0.0
  • @stdlib/utils-convert-path ^0.2.1
  • lodash ^4.17.21
  • micromatch ^4.0.5
  • yaml ^2.3.1
  • @types/jest ^29.5.2
  • @types/lodash ^4.14.195
  • @types/micromatch ^4.0.2
  • @types/node ^20.3.2
  • @types/uuid ^10.0.0
  • @typescript-eslint/eslint-plugin ^7.0.0
  • @typescript-eslint/parser ^7.0.0
  • @vercel/ncc ^0.38.0
  • eslint ^8.43.0
  • eslint-config-prettier ^9.0.0
  • eslint-plugin-github ^5.0.0
  • eslint-plugin-jest ^28.0.0
  • eslint-plugin-prettier ^5.0.0-alpha.2
  • jest ^29.5.0
  • prettier ^3.0.0
  • ts-jest ^29.1.0
  • typescript ^5.1.3

  • Check this box to trigger a request for Renovate to run again on this repository

[BUG] Files input doesn't work when running with `act`

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?

When running this action with act (medium image) and providing a files input, the full list of modified files is returned rather than the a filtered list.

To Reproduce

  1. Add action to repo as configured below
  2. Add multiple changed files in commit, but only 1 with a .yaml extension
  3. Run action locally with act
name: Test

on:
  push:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Get changes
        id: changes
        uses: tj-actions/[email protected]
        with:
          files: \.yaml$

      - name: Show changes
        shell: bash
        run: |
          set -euo pipefail

          for file in ${{ steps.changes.outputs.all_modified_files }}
          do
            echo "${file}"
          done

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

The same output should happen with act and on GitHub.

Relevant log output

No response

Anything else?

No response

Code of Conduct

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

Request: Option to Output Whole File Path

Is your feature request related to a problem? Please describe.
I want to check if the file that's changed is in a specific directory.

Describe the solution you'd like

with:
  show_file_path: true

Describe alternatives you've considered
I could do git status and check within a run: block, but it seems like it would fit bettere as part of this action

Additional context
Sample output:

{
  added_files: Dockerfile src/components/Modal.jsx
  ...
}

[Feature] Add support for checkout path

Is your feature request related to a problem? Please describe.

I am checking out multiple repositories like this:

      - name: Checkout this repo
        uses: actions/checkout@v2
        with:
          path: this
          fetch-depth: 2

      - name: Checkout another repo
        uses: actions/checkout@v2
        with:
          repository: SomeAccount/AnotherRepo
          path: another
          fetch-depth: 2

But this action only works for default checkout path.

Describe the solution you'd like?

Like this:

      - name: Get changed files from this repo
        id: changed-files-this
        uses: tj-actions/[email protected]
        with:
          #  Same path as in the "checkout" action
          path: this

      - name: Get changed files from another repo
        id: changed-files-another
        uses: tj-actions/[email protected]
        with:
          #  Same path as in the "checkout" action
          path: another

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

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

issues with failed getting changed files

hi,
I met the following errors when using git enterprise. btw, I use ssh login the git repo other than username/password. I changed other repo with .git subdirectory, it still complains the same error. I double checked my repo it works fine but still failed to get this github action works

error log:

Run tj-actions/changed-files@v7
with:
token: ***
separator:
/usr/bin/docker run --name fe336efc00c723f4a47d480e9c9a46f254d67_122cbd --label 6fe336 --workdir /github/workspace --rm -e INPUT_TOKEN -e INPUT_SEPARATOR -e INPUT_FILES -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/daniel/actions-runner/_work/_temp/_github_home":"/github/home" -v "/home/daniel/actions-runner/_work/_temp/_github_workflow":"/github/workflow" -v "/home/daniel/actions-runner/_work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/daniel/actions-runner/_work/temp-repo-4-github-action/temp-repo-4-github-action":"/github/workspace" 6fe336:efc00c723f4a47d480e9c9a46f254d67
fatal: not a git repository (or any parent up to mount point /github)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

my .git/workflow/ci.yaml

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
changedfiles:
runs-on: [ self-hosted ]
name: Test changed-files
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

  - name: Get changed files
    id: changed-files
    uses: tj-actions/changed-files@v7
  
  - name: List all modified files
    run: |
      for file in "${{ steps.changed-files.outputs.all_modified_files }}"; do
        echo "$file was modified"
      done

[Feature] Ability to run a workflow if and only if certain file/directory changes

Is your feature request related to a problem? Please describe.

Use case:
I want to run a workflow if and only if any file under a certain directory changes.

If any other files have changed I do not want to run the workflow.

In my case, I'm trying to auto-approve a PR using this action https://github.com/marketplace/actions/auto-approve
but only if files under the dev directory have been updated, and nothing else.

Describe the solution you'd like?

Ideally something like this:

    steps:
    - uses: actions/checkout@v2
    - name: Get changed files for dev
      id: changed-files-dev
      uses: tj-actions/[email protected]
      with:
        files: |
          dev
    - uses: hmarr/auto-approve-action@v2
      if: steps.changed-files-dev.outputs.only_changed == 'true'
      with:
        github-token: "${{ secrets.GITHUB_TOKEN }}"

Where only_changed would be true if any file in that directory were present, and ONLY files in that directory were in the diff (i.e no other files)

Describe alternatives you've considered?

I've tried something like this:

    steps:
    - uses: actions/checkout@v2
    - name: Get changed files for dev
      id: changed-files-dev
      uses: tj-actions/[email protected]
      with:
        files: |
          dev
    - name: Get changed files for all
      id: changed-files-rest
      uses: tj-actions/[email protected]
      with:
        files: |
          ^(dev)
    - uses: hmarr/auto-approve-action@v2
      if: steps.changed-files-dev.outputs.any_changed == 'true' && steps.changed-files-rest.outputs.any_changed == 'false'
      with:
        github-token: "${{ secrets.GITHUB_TOKEN }}"

But that doesn't seem to work and feels clunky.

Anything else?

No response

Code of Conduct

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.