Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
file

GitHub Action

Read File Content

v1.1.1

Read File Content

file

Read File Content

Read file contents. You can also get the file content in the branch

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Read File Content

uses: jaywcjlove/github-action-read-file@v1.1.1

Learn more about this action in jaywcjlove/github-action-read-file

Choose a version

Read File Content

Read file contents. You can also get the file content in the branch

Example Usage

- name: Read README.md
  id: package
  uses: jaywcjlove/github-action-read-file@main
  with:
    path: package.json

- name: Echo package.json
  run: echo "${{ steps.package.outputs.content }}"

Specify the branch to read the file content

- name: Read README.md(gh-pages)
  id: ghpages
  uses: jaywcjlove/github-action-read-file@main
  with:
    branch: gh-pages
    path: README.md

- name: Echo README.md(gh-pages)
  run: echo "${{ steps.ghpages.outputs.content }}"

Inputs

  • path File path. E.g: src/index.ts
  • branch the branch where the file resides. Default: ${{ github.ref_name }}, E.g: main, gh-pages

Outputs

  • content text file content
  • type
  • encoding
  • name
  • path
  • sha
  • size file size
  • url Format: uri
  • git_url Format: uri
  • html_url Format: uri
  • download_url Format: uri
  • target @example "actual/actual.md"
  • submodule_git_url @example "git://example.com/defunkt/dotjs.git"

See Also

License

Licensed under the MIT License.