A GitHub Action to inject text into an exisiting file at a given position.
Required: true
Description: Filepath to the file to injet into, relative to the project root
Example: ./CHANGELOG.md
Required: true
Description: The content that should get injected. Can also be provided by the env 'CONTENT'. The reason for that is, the GitHub Actions trims all space/newline charachters from the start/end of the input.
Default: after
Description: should the new text be added before or after the position-regex match? Allowed values: before
, after
.
Default: $
Description: RegExp String where the new content should be added. Defaults to the end of the file.
Example: ^
for the beginning of the file.
Default: ``
Description: RegExp flags to use.
Example: i
for case insensitive regexp matching.
The new file content
name: Append Commit
on: [push]
jobs:
commit-date:
runs-on: ubuntu-latest
steps:
- name: clone repo
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: inject text
uses: adrianjost/file-inject@master
with:
filepath: "./COMMITS.md"
content: "NEW CONTENT"
- name: commit COMMITS.md
uses: stefanzweifel/git-auto-commit-action@v4.1.1
with:
commit_message: "update COMMITS.md"