Giter Site home page Giter Site logo

yoichiro_gh-action-increment-value's Introduction

Increment a value GitHub Actions

This GitHub Actions increments a value written in a file specified by condition automatically.

How to Use

If you have the build-number.json file below in the foobar/baz directory:

{"buildNumber":3}

The example of the increment.yaml YAML file in the .github/workflows directory is the following:

name: Increment value test
on:
  push:
    branches:
      - main
    paths-ignore:
      - 'foobar/baz/build_number.json'
jobs:
  test:
    name: Increment value test
    runs-on: ubuntu-latest
    steps:
      - name: Check out source code
        uses: actions/checkout@v2
        with:
          ref: ${{ github.ref }}
          token: ${{ secrets.YOUR_PERSONAL_ACCESS_TOKEN }}
      - name: Increment value
        uses: yoichiro/gh-action-increment-value@main
        with:
          target_directory: 'foobar/baz'
          target_file: 'build_number.json'
          prefix: 'buildNumber":'
          suffix: '}'
          commit_message: 'Increment the build number to '
  • target_directory - The directory path where there is the target file.
  • target_file - The target file name.
  • prefix - The prefix string to determine the start position of the target number.
  • suffix - The suffix string to determine the end position of the target number.
  • commit_message - The commit message (automatically the number appended.).

To push the commit of updating the number successfully, you may specify the personal access token who has a permission (which has a repo scope) to push the commit. For example, if there are some rules to protect the branch, you need to specify the token to avoid the rules.

Also, you need to specify the paths-ignore to avoid executing the same job continuously.

yoichiro_gh-action-increment-value's People

Contributors

yoichiro 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.