Thanks to visit codestin.com
Credit goes to github.com

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

Replace text content and submit content

Here is the example: update time 2022-11-24 05:28:32

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

Inputs

  • token Your GITHUB_TOKEN. This is required. Why do we need token? Read more here: About the GITHUB_TOKEN secret. Default: ${{ github.token }}
  • body what needs to be replaced
  • path file to be replaced
  • ref The fully-formed ref of the branch or tag that triggered the workflow run.
  • overwrite Overwrite the entire file content, by default false
  • sync_local_file Sync local file content, by default true
  • message The commit message. by default doc: update <file path>.
  • committer_name The name of the author or committer of the commit. by default github-actions[bot]
  • committer_email The email of the author or committer of the commit. by default github-actions[bot]@users.noreply.github.com
  • openDelimiter Character to use for opening delimiter, by default "<!--GAMFC-->"
  • closeDelimiter Character to use for closing delimiter, by default "<!--GAMFC-END-->"

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-->2022-11-24 05:28:32<!--GAMFC-END-->

Replace the content between <!--GAMFC-->2022-11-24 05:28:32<!--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'

See Also

License

Licensed under the MIT License.