/replace-string-in-file

Replace string in file, works with ubuntu, windows, macos

Apache License 2.0Apache-2.0

Replace string in file

Test Actions on Ubunut, Macos and Windows

Replace string in file, works with Ubuntu, Windows, Macos.

Usage

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

With regex

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

Contribute

Setup development environment

-OR-

  • Use the devcontainer inside this project with GitHub Codespaces or any other IDE that supports devcontainers.

Test

  • Run act command to test the workflow locally

License

The Dockerfile and associated scripts and documentation in this project are released under the Apache 2.0 License.