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

[Feature] Provide flag to detect if anything in dir has changed #2404

Closed
2 tasks done
jtuchel opened this issue Jan 17, 2025 · 2 comments
Closed
2 tasks done

[Feature] Provide flag to detect if anything in dir has changed #2404

jtuchel opened this issue Jan 17, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@jtuchel
Copy link

jtuchel commented Jan 17, 2025

Is this feature missing in the latest version?

  • I'm using the latest release

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

I just want to detect if anything in a given directory has changed ( file added, file removed, file renamed, ... )

When using this approach

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 2

      - name: Check if anything in system directory has changed
        id: check_changed_files
        uses: tj-actions/changed-files@v45
        with:
            files: ${{ runner.name }}/**

    # usage: if: ${{ steps.check_changed_files.outputs.any_changed == 'true' }}

it won't detect deleted files for example.

Describe the solution you'd like?

It would be nice to have a boolean flag like output_anything_has_changed

Describe alternatives you've considered?

I'm not sure if this is possible with a combination of existing flags. I couldn't find a flag for deleted files.

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jtuchel jtuchel added the enhancement New feature or request label Jan 17, 2025
@tj-actions-bot
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.

@jackton1
Copy link
Member

jackton1 commented Jan 20, 2025

Hi @jtuchel, This already exists as an output.

If you want to detect if a file was (added, deleted, renamed, ... ), you can use any_modified output; Alternatively, you can use a combination of any_deleted and any_changed to achieve the same outcome.

E.g

  1. any_modified
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 2

      - name: Check if anything in system directory has changed
        id: check_changed_files
        uses: tj-actions/changed-files@v45
        with:
            files: ${{ runner.name }}/**

    - name: Run step if any of the listed files above is modified
      if: steps.check_changed_files.outputs.any_modified == 'true' 
  1. A combination of any_deleted and any_changed
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 2

      - name: Check if anything in system directory has changed
        id: check_changed_files
        uses: tj-actions/changed-files@v45
        with:
            files: ${{ runner.name }}/**

    - name: Run step if any of the listed files above is modified
      if: steps.check_changed_files.outputs.any_changed == 'true' || steps.check_changed_files.outputs.any_deleted == 'true' 

If you would like more information on available outputs. See the documentation

@jackton1 jackton1 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants