Replace string in file, works with Ubuntu, Windows, Macos.
The workflow, usually declared in .github/workflows/replace-string-in-file.yml
, looks like:
name: Replace string in file
on:
push:
branches:
- master
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Replace string in file
uses: MathieuSoysal/replace-string-in-file@v1.1.0
with:
file: tests/test-file.txt
old-string: WHAT
new-string: World
name: Replace string in file
on:
push:
branches:
- master
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Replace string in file
uses: MathieuSoysal/replace-string-in-file@v1.1.0
with:
file: tests/test-file.txt
old-string: 'W.*T$'
new-string: World
- Add Nektos/act to test the workflow locally
-OR-
- Use the devcontainer inside this project with GitHub Codespaces or any other IDE that supports devcontainers.
- Run
act
command to test the workflow locally
The Dockerfile and associated scripts and documentation in this project are released under the Apache 2.0 License.