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

Syntax error on negation in gitignore #65

Closed
fatbasstard opened this issue May 13, 2024 · 4 comments · Fixed by #66
Closed

Syntax error on negation in gitignore #65

fatbasstard opened this issue May 13, 2024 · 4 comments · Fixed by #66
Assignees
Labels
bug Something isn't working

Comments

@fatbasstard
Copy link

fatbasstard commented May 13, 2024

We've got the following line in .gitignore:

!functions/**/local.env

This results in the following Syntax error:

Run GrantBirki/[email protected]
  with:
    github_token: ***
    mode: fail
    comment: false
    base_dir: .
    use_dot_match: true
    json_schema_version: draft-07
    json_extension: .json
    use_ajv_formats: true
    yaml_extension: .yaml
    yaml_extension_short: .yml
    yaml_as_json: false
    use_gitignore: true
    git_ignore_path: .gitignore
    allow_multiple_documents: false
    ajv_strict_mode: true

/home/runner/work/_actions/GrantBirki/json-yaml-validate/v[2](https://github.com/xxx/xxx/actions/runs/9063058018/job/24898214270?pr=163#step:3:2).7.1/src/functions/exclude.js:77
        const regex = new RegExp(pattern.replace(/^!/, ''))
^
SyntaxError: Invalid regular expression: /functions/**/local.env/: Nothing to repeat
    at new RegExp (<anonymous>)
    at Exclude.isExcluded (/home/runner/work/_actions/GrantBirki/json-yaml-validate/v2.[7](https://github.com/xxx/xxx/actions/runs/9063058018/job/24898214270?pr=163#step:3:7).1/src/functions/exclude.js:77:1)
    at yamlValidator (/home/runner/work/_actions/GrantBirki/json-yaml-validate/v2.7.1/src/functions/yaml-validator.js:90:1)
    at run (/home/runner/work/_actions/GrantBirki/json-yaml-validate/v2.7.1/src/main.js:[8](https://github.com/xxx/xxx/actions/runs/9063058018/job/24898214270?pr=163#step:3:8):1)
    ```
@GrantBirki GrantBirki self-assigned this May 19, 2024
@GrantBirki GrantBirki added the bug Something isn't working label May 19, 2024
@GrantBirki
Copy link
Owner

When I wrote this Action a while ago, I just hacked together some logic to get some basic "ignore" style matching working. It is clear now that I should use something a bit more robust. I will try to bake in this package into the project for better .gitignore style support and publish a new release for you as well. Thanks for bringing this to my attention! ✨

@GrantBirki
Copy link
Owner

I have a PR that I will merge soon that should fix this problem. It will result in a new major release of this Action.

@GrantBirki
Copy link
Owner

@fatbasstard I have published a pre-release (v3.0.0) that I will publish as the latest release in the near future. Please go ahead and try it out and let me know if you have any issues. Thanks!

@fatbasstard
Copy link
Author

Hi @GrantBirki

Thanks for the fix. We've "solved" this by setting use_gitignore to false. Since the files in GIthub are already excluded by that file, it feels useless to still try to exclude files that are already excluded. So for a github actions the setting doesn't really makes sense?

Will update the latest version soon to try anyway 👍

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

Successfully merging a pull request may close this issue.

2 participants