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] Add support for detecting changes in submodules #349

Closed
3 tasks done
pkit opened this issue Feb 9, 2022 · 10 comments · Fixed by #350, #394 or CaspianDB/changed-files#1
Closed
3 tasks done

[Feature] Add support for detecting changes in submodules #349

pkit opened this issue Feb 9, 2022 · 10 comments · Fixed by #350, #394 or CaspianDB/changed-files#1
Labels
enhancement New feature or request

Comments

@pkit
Copy link
Contributor

pkit commented Feb 9, 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?

This action uses github API which will notice any submodule change as a change in ./submodule_name "file" and nothing else.
Actual changes in actual files will go unnoticed

To Reproduce

Run on any repo with a change in a submodule
See the following output:

Resolving repository path...
  Setting up 'temp_changed_files' remote...
  No 'temp_changed_files' remote found
  Creating 'temp_changed_files' remote...
  Getting HEAD info...
  Retrieving changes between 12345789abcdef (main) → 22345789abcdef (main)
  Getting diff...
  Added files: 
  Copied files: 
  Deleted files: 
  Modified files: submodule_name
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed and modified files: submodule_name
  All changed files: submodule_name
  All modified files: submodule_name

What OS are you seeing the problem on?

all

Expected behavior?

Actual subdirectories are checked (not only the Github API output)

Relevant log output

No response

Anything else?

No response

Code of Conduct

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

github-actions bot commented Feb 9, 2022

Thanks for reporting this issue.

@jackton1
Copy link
Member

jackton1 commented Feb 9, 2022

@pkit Seems like this is a feature request as submodules aren't supported at the moment and can you also include the workflow configuration i.e what were you trying to do ?

Based on the current design all change detection is done locally via a git executable and no interactions to Github's API is performed.

@jackton1 jackton1 added enhancement New feature or request and removed bug Something isn't working labels Feb 9, 2022
@jackton1 jackton1 changed the title [BUG] will fail to notice that files did change in submodules [Feature] will fail to notice that files did change in submodules Feb 9, 2022
@jackton1 jackton1 changed the title [Feature] will fail to notice that files did change in submodules [Feature] Add support for detecting changes in submodules Feb 9, 2022
@pkit
Copy link
Contributor Author

pkit commented Feb 9, 2022

Based on the current design all change detection is done locally via a git executable and no interactions to Github's API is performed.

The github repo was checked out with all the submodules locally

I can see that call stack goes like that: tj-actions/changed-files -> tj-actions/glob@v6 -> actions/github-script@v5 which does call github API

Example workflow excerpt:

      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
          submodules: recursive
          token: ${{ secrets.BUILD_BOT_TOKEN }}
      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@v14.4
        with:
          files: |
            "submodule_name/**"
            "*.js"

@jackton1
Copy link
Member

jackton1 commented Feb 9, 2022

Oh actions/github-script@v5 doesn't interact with Github's API it's used to run a js script for matching file patterns.

@jackton1 jackton1 linked a pull request Feb 10, 2022 that will close this issue
@jackton1
Copy link
Member

jackton1 commented Feb 10, 2022

@pkit This should be resolved in the latest release. Thanks

@pkit
Copy link
Contributor Author

pkit commented Feb 10, 2022

@jackton1 thanks and sorry. Didn't read into you code much.

@jackton1 jackton1 reopened this Feb 10, 2022
@jackton1
Copy link
Member

No worries, seems this requires more work since there's no clean way to do this from the super project.

@pkit
Copy link
Contributor Author

pkit commented Feb 21, 2022

@jackton1 implemented, it was pretty involving
Should support submodules in submodules now

@jackton1
Copy link
Member

jackton1 commented Feb 22, 2022

Cool could you add a submodule that can be used for the test

pkit pushed a commit to pkit/changed-files that referenced this issue Feb 22, 2022
@pkit
Copy link
Contributor Author

pkit commented Feb 22, 2022

Hmm, I'm not sure I understand how the test output is checked.
But this repo can be added as a submodule to itself.
Which I did now :)

@pkit pkit reopened this Feb 22, 2022
jackton1 added a commit that referenced this issue Feb 23, 2022
* feat: Add support for detecting submodules changes

Closes: #349

* add bash<4.4 fix

* add bash<4.4 fix

* Added more than 1 submodule.

* Update entrypoint.sh

* Removed submodule.

* Update test.yml

* Update test.yml

* Updated .gitmodules.

* Updated submodule.

* Updated submodule.

* Added a new submodule resolving testing errors.

* Added a new submodule.

* Removed new submodule.

* Fixed test.

Co-authored-by: Tonye Jack <jtonye@ymail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment