Skip to content

jaywcjlove/github-action-modify-file-content

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

Modify File Content

Buy me a coffee test

Replace text content and submit content

Here is the example: update time 2025-05-12 17:15:59

Here is the different delimiter example: different GAMFC_TABEL & GAMFC_TABEL-END (test)

Inputs

Name Required Default Description
token ${{ github.token }} GitHub Token used to authenticate API requests. Why?
body The content to insert between delimiters in the target file.
trim_whitespace true Trim leading and trailing whitespace in body.
path File path to be modified.
branch ${{ github.ref_name }} Branch to commit changes to.
ref Default branch (usually master) The target commit, branch, or tag.
overwrite false Whether to overwrite the entire file.
sync_local_file true Whether to sync the file from the local content.
message doc: update <file path>. Commit message.
committer_name github-actions[bot] Name used for the Git commit author.
committer_email github-actions[bot]@users.noreply.github.com Email used for the Git commit author.
openDelimiter <!--GAMFC-->2025-05-12 17:15:59<!--GAMFC-END--> End delimiter for content replacement.

Outputs

  • content text file content

Example Usage

- name: Modify README.md
  uses: jaywcjlove/github-action-modify-file-content@main
  with:
    path: README.md

README.md file content

update time <!--GAMFC-->2025-05-12 17:15:59<!--GAMFC-END-->

Replace the content between <!--GAMFC-->2025-05-12 17:15:59<!--GAMFC-END-->.

format date

- name: Modify README.md
  uses: jaywcjlove/github-action-modify-file-content@main
  with:
    path: README.md
    body: "{{date:YYYY-MM-DD HH:mm:ss}}"

overwrite file

- name: Modify README.md
  uses: jaywcjlove/github-action-modify-file-content@main
  with:
    path: README.md
    body: "overwrite file content {{date:YYYY-MM-DD HH:mm:ss}}",
    overwrite: 'true'

specify branch changes

- name: Modify test test/overwrite.file.md
  uses: jaywcjlove/github-action-modify-file-content@main
  with:
    branch: test
    path: test/overwrite.file.md
    body: "{{date:YYYY-MM-DD HH:mm:ss}}"
    overwrite: 'true'

See Also

Contributors

As always, thanks to our amazing contributors!

小弟调调

License

Licensed under the MIT License.

About

Replace text content and submit content

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •