Skip to content

guibranco/github-file-reader-action-v2

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
Β 
Β 

GitHub File Reader Action V2

GitHub repo GitHub code size in bytes GitHub last commit GitHub license

Check Dist CI CodeQL Linter wakatime

GitHub Action to read the contents of a file

Important

Disclaimer: This version was created because the creator has not updated the original (V1) for a while.

This is a GitHub Action that reads a file's contents. If you give it a path to a file, it will provide its contents and file size, accessible through an output variable.

Usage

The following example workflow step will read the contents of the package.json file.

- name: 'Read file contents'
  uses: guibranco/github-file-reader-action-v2@latest
  id: read_file
  with:
    path: 'package.json'

Options βš™οΈ

The following input variable options can/must be configured:

Input variable Necessity Description Default
path Required the path to the file to read.
encoding Optional the encoding of the file to read. utf8

Outputs

  • contents: The contents of the file.
  • size: The size of the file.

Example

name: 'Read file contents'

on: [push, pull_request]

jobs:
  file_contents:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Read file contents
        uses: guibranco/github-file-reader-action-v2@latest
        id: read_file
        with:
          path: 'package.json'

      - name: File contents
        run: echo "${ steps.read_file.outputs.contents }"

      - name: File size
        run: echo "${ steps.read_file.outputs.size }"

License

Copyright Β© 2024 AndrΓ© Storhaug, GuiBranco.

file-reader-action-v2 is licensed under the MIT License.

About

πŸ“„ :octocat: GitHub Action to read the contents of a file

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 66.4%
  • Shell 33.6%