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).
Required The source string to apply this action to
Required The text you want to search for within the branch name (eg. ref/heads/
)
Required The text you want to replace (eg. head-
, ``, root_
)
Optional Should replace all occurrences? (only 'true' string will be interpreted positive)
The new value containing the found-and-replaced string.
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