Code Monkey home page Code Monkey logo

file-regex-replace's Introduction

File-Regex-Replace

Parameters

Name Required Default Value Description
regex True - The regex you want to search for.
replacement True - The replacement string. Note that you could use captured groups in above regex to do replacement.
flags False g regex flags in javascript, see this
include False .* 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 False .^ Same as include. By default, it matches nothing.
encoding False utf8 String encodings for files. By default, it uses UTF-8
path False . Path you want to start walk with. By default, it starts from .(the root of the repo)

Example

Example action file

    - name: Modify version number
      uses: mingjun97/file-regex-replace
      with:
        regex: '"version": "([0-9\.]*)",'
        replacement: '"version": "$1-test",'
        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 '.'

Why Build This

I build this Github Action to help build a nightly release to make the workflow could automaticly append a string -nightly after the version number recorded in package.json.

There is no other existing workflow could meet my requirements as far as I searched. jacobtomlinson/gha-find-replace, which I borrowed ideas from, works well but it only supports linux platform. Thus my nightly build workflow could not work for multiple platform.

file-regex-replace's People

Contributors

ashley-taylor avatar happypig375 avatar mingjun97 avatar nmoinvaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.