GithubHelp home page GithubHelp logo

test-room-7_action-update-file's Introduction

action-update-file Version Lint status

Update (i.e. commit and push) files on GitHub.

The action is perfectly suitable for updating files generated by scripts or other actions (e.g. distribution files).

Usage

The action requires GitHub token for authentication; no username or e-mail are required.

Basic usage

Here is an example of a workflow using action-update-file:

name: Resources
on: repository_dispatch
jobs:
    resources:
        name: Update resources
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v1

            - uses: actions/setup-node@v1

            - name: Fetch resources
              run: ./scripts/fetch-resources.sh

            - name: Update resources
              uses: test-room-7/action-update-file@v1
              with:
                  file-path: path/to/file
                  commit-msg: Update resources
                  github-token: ${{ secrets.GITHUB_TOKEN }}

Note that this action does not change files. They should be changed with scripts and/or other actions.

Update multiple files

You can also update multiple files:

- name: Update resources
  uses: test-room-7/action-update-file@v1
  with:
      file-path: |
          path/to/file1
          path/to/file2
          path/to/file3
      commit-msg: Update resources
      github-token: ${{ secrets.GITHUB_TOKEN }}

Use glob patterns

The action supports glob patterns as well:

- name: Update resources
  uses: test-room-7/action-update-file@v1
  with:
      # Include all JS files from the `dist` directory
      file-path: dist/*.js
      commit-msg: Update resources
      github-token: ${{ secrets.GITHUB_TOKEN }}

See the fast-glob documentation for glob syntax.

Inputs

Required inputs

  • commit-msg: a text used as a commit message
  • file-path: a path to file(s) or a glob pattern
  • github-token: GitHub token

Optional inputs

  • branch: branch to push changes (the default branch is used if no branch is specified)
  • allow-dot: allow glob patterns to match entries that begin with a period (false by default)
  • allow-removing: allow to remove file if local copy is missing (false by default)
  • committer-name: The name of the author (or committer) of the commit. (github-actions[bot] by default)
  • committer-email: The email of the author (or committer) of the commit. (github-actions[bot]@users.noreply.github.com by default)

Note that the action will produce an error if a local copy of a given file is missing, and the allow-removing flag is false.

Outputs

  • commit-sha: the hash of the commit created by this action

Development

# Install dependencies
> npm install

# Build the action
> npm run dist

# Lint project files
> npm run lint

Don't push dist files; they're updated automatically by the action itself.

License

Licensed under the MIT License.

test-room-7_action-update-file's People

Contributors

alexesprit avatar dependabot[bot] avatar github-actions[bot] avatar luisfalconmx 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.