Skip to content

Automatically update a file by replace marked section with the given content

License

Notifications You must be signed in to change notification settings

wow-actions/update-file

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Update File

build MIT License Language PRs Welcome website Language grade: JavaScript

Automatically update a file by replace marked section with the given content

🚀 Usage

  1. Specify the location to update in your the file by adding opening_comment and closing_comment. Such as you can add comments in your markdown file:
<!-- [START AUTO UPDATE] -->
<!-- Please keep comment here to allow auto-update -->
Updated by update-file action
<!-- [END AUTO UPDATE] -->
  1. Create a .github/workflows/update-file.yml file in the repository you want to install this action, then add the following to it:
name: Update File
on:
  push:
    branches:
      - master
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: wow-actions/update-file@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          path: README.md
          content: 'Updated by update-file action'

Inputs

Various inputs are defined to let you configure the action:

Note: Workflow command and parameter names are not case-sensitive.

Name Description Default
GITHUB_TOKEN The GitHub token for authentication N/A
badges Badges to add N/A
path File path to update N/A
content Content to update the file N/A
commit_message Commit message when update the file 'chore: update [skip ci]'
opening_comment The comment to match the start line of section to update '<!-- [START AUTO UPDATE] -->'
closing_comment The comment to match the end line of section to update '<!-- [END AUTO UPDATE] -->'
warning_comment The comment to match the end line of section to update '<!-- Please keep comment here to allow auto-update -->'

🔖 License

The scripts and documentation in this project are released under the MIT License

About

Automatically update a file by replace marked section with the given content

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published