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

changed files no committed #233

Closed
staabm opened this issue Jul 26, 2022 · 5 comments
Closed

changed files no committed #233

staabm opened this issue Jul 26, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@staabm
Copy link

staabm commented Jul 26, 2022

Version of the Action
v4

Describe the bug
it seems the action does not commit all changed files (files in subfolders are left behind).

the action properly detects that the files contain changes, as can be seen in the github action log:

Run stefanzweifel/git-auto-commit-action@v4
  with:
    commit_message: Apply phpstan-baseline changes
    file_pattern: *.neon
    repository: .
    commit_user_name: github-actions[bot]
    commit_user_email: github-actions[bot]@users.noreply.github.com
    commit_author: gh-kundenserver <gh-xxx@users.noreply.github.com>
    skip_dirty_check: false
    skip_fetch: false
    skip_checkout: false
    disable_globbing: false
    create_branch: false
  env:
    COMPOSER_PROCESS_TIMEOUT: 0
    COMPOSER_NO_INTERACTION: 1
    CACHE_RESTORE_KEY: Linux-php-8.0.[2](https://github.com/complex-gmbh/php-clxproductnet/runs/7521420905?check_suite_focus=true#step:15:2)1-composer---prefer-dist---no-progress---no-suggest-locked-
Started: bash /home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/entrypoint.sh
INPUT_REPOSITORY value: .
INPUT_STATUS_OPTIONS: 
INPUT_BRANCH value: 
From https://github.com/complex-gmbh/php-clxproductnet
 * [new branch]      smu-pricing             -> origin/smu-pricing
M	composer.json
M	phpstan-baseline.neon
M	scripts/phpstan-baseline.neon
Your branch is up to date with 'origin/types'.
INPUT_ADD_OPTIONS: 
INPUT_FILE_PATTERN: *.neon
INPUT_COMMIT_OPTIONS: 
INPUT_COMMIT_USER_NAME: github-actions[bot]
INPUT_COMMIT_USER_EMAIL: github-actions[bot]@users.noreply.github.com
INPUT_COMMIT_MESSAGE: Apply phpstan-baseline changes
INPUT_COMMIT_AUTHOR: gh-xxx<gh-xxx@users.noreply.github.com>
[types 16[8](https://github.com/complex-gmbh/php-clxproductnet/runs/7521420905?check_suite_focus=true#step:15:8)246e] Apply phpstan-baseline changes
 Author: gh-kundenserver <gh-xxx@users.noreply.github.com>
 1 file changed, [11](https://github.com/complex-gmbh/php-clxproductnet/runs/7521420905?check_suite_focus=true#step:15:11) insertions(+), 1 deletion(-)
INPUT_TAGGING_MESSAGE: 
No tagging message supplied. No tag will be added.

.. only M phpstan-baseline.neon is committed, but not M scripts/phpstan-baseline.neon

To Reproduce
workflow step:

      - name: Commit changed files
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: Apply phpstan-baseline changes
          branch: ${{ github.head_ref }}
          file_pattern: '*.neon' 

Expected behavior
since the pattern is *.neon I would expect the action to commit all changed *neon files, no matter in which directory they are contained

Screenshots
n/a
Used Workflow

# Paste the Workflow you've used here

Additional context
I am pretty sure this worked in the past, and it seems to have regressed in a recent release?

@stefanzweifel
Copy link
Owner

The responsible line for adding files to the commit has not been updated in the last 15 months.

However, git-status and git-add differs as $INPUT_FILE_PATTERN is in quotes in git-status; but not in git-add.
If I remember correctly, I did this on purpose to prevent globbing. 🤔

Have to do some manual testing.

@stefanzweifel stefanzweifel added the bug Something isn't working label Jul 27, 2022
stefanzweifel added a commit that referenced this issue Jul 30, 2022
@stefanzweifel
Copy link
Owner

I've added a test in dce7e85 to cover this scenario.

To commit all files, it seems you have to add a pattern to explictly look for neon-files in sub folders. (Not sure what the correct technical term is here)

In your example it would be *.neon **/*.neon

  - name: Commit changed files
    uses: stefanzweifel/git-auto-commit-action@v4
    with:
      commit_message: Apply phpstan-baseline changes
      branch: ${{ github.head_ref }}
-     file_pattern: '*.neon' 
+     file_pattern: '*.neon **/*.neon' 

Could you give this a try?

@staabm
Copy link
Author

staabm commented Jul 30, 2022

Thx for the investigation

Should file_pattern: '**.neon' also work then?

@stefanzweifel
Copy link
Owner

@staabm Yeah that seems to work too.

Triggered a test run in a test repo with file_pattern: '**.php':

PHP files in the root and in a nested folder have been commited: stefanzweifel/git-auto-commit-action-demo-app@0e9ba3a

@staabm
Copy link
Author

staabm commented Jul 31, 2022

ok cool, thank you.

from my POV this issue can be closed

@staabm staabm closed this as completed Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants