https://github.com/step-security/actions-find-and-replace-string
A GitHub action to execute find-and-replace on strings
https://github.com/step-security/actions-find-and-replace-string
step-security-maintained-actions
Last synced: 2 months ago
JSON representation
A GitHub action to execute find-and-replace on strings
- Host: GitHub
- URL: https://github.com/step-security/actions-find-and-replace-string
- Owner: step-security
- License: mit
- Created: 2024-10-28T13:48:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-20T22:56:05.000Z (over 1 year ago)
- Last Synced: 2025-01-01T02:28:23.827Z (over 1 year ago)
- Topics: step-security-maintained-actions
- Language: JavaScript
- Homepage:
- Size: 136 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Find and replace strings
This action executes find-and-replace on a given string (hint: use `${{ github.ref }}` to get your branch name and apply this on it for use in another action).
## Inputs
### `source`
**Required** The source string to apply this action to
### `find`
**Required** The text you want to search for within the branch name (eg. `ref/heads/`)
### `replace`
**Required** The text you want to replace (eg. `head-`, ``, `root_`)
### `replaceAll`
**Optional** Should replace all occurrences? (only 'true' string will be interpreted positive)
## Outputs
### `value`
The new value containing the found-and-replaced string.
### Example usage
```yaml
uses: step-security/actions-find-and-replace-string@v5
with:
source: ${{ github.ref }} # this translates to ref/heads/main on the main branch, but can be any arbitrary string
find: 'ref/heads/' # we want to remove ref/heads/ from source
replace: '' # and replace it with a blank string (ie. removing it)
```
This will output `main`.
Check out `.github/workflows/main.yml` for more examples