Automatically update a file by replace marked section with the given content
- Specify the location to update in your the file by adding
opening_comment
andclosing_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] -->
- 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'
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 -->' |
The scripts and documentation in this project are released under the MIT License