GitHub Action
Find and lowercase
v1.1.5
Latest version
GitHub Action to find regex matches on files and transform them to lowercase.
Based on File Regex Replace action.
Name | Required | Default Value | Description |
---|---|---|---|
regex | ✔️ | - | The regex you want to search for. |
flags | ❌ | g |
regex flags in javascript, see this |
include | ❌ | .* |
Filter out which files to be modified, this should be a regex. Note that match is checked on full path, any part of the path match will be modified. You may use ^path/to/file to filter from the beginning of the files' path. By default, it matches every file. |
exclude | ❌ | .^ |
Same as include. By default, it matches nothing. |
encoding | ❌ | utf8 |
String encodings for files. By default, it uses UTF-8 |
path | ❌ | . |
Path you want to start walk with. By default, it starts from . (the root of the repo) |
- name: Change url's to lowercase
uses: SofieTorch/find-and-lowercase-action@v1.1.3
with:
regex: '<a href="([^"]+(\.html|#.+))">'
flags: "g" # Optional, defaults to "g"
include: 'package\.json' # Optional, defaults to ".*"
exclude: '.^' # Optional, defaults to '.^'
encoding: 'utf8' # Optional, defaults to 'utf8'
path: '.' # Optional, defaults to '.'
While generating API documentation inside MD documentation for a Flutter project, the file names for my API docs where changed to lowercase, so the redirection and navigation through the web page was broken (as the links were still under the original file names).
I created this action to fix it, changing a regex match to lowercase; in my case, changing the url's to lowercase when using this action.
I found other interesting GitHub Actions to replace text based on regex, specially this,
which is what I based this action on.