Skip to content

Workflow expression to read file content #1180

Description

@maxim-lobanov

Describe the enhancement
It would be great to have some function or expression to read file content (readFile or contents).
Something like {{ contents('.nvmrc') }}

Code Snippet

uses: setup-node@v1
with:
  node-version: {{ contents('.nvmrc') }}

Additional information
We already have functions that works with FileSystem, for example hashFiles.
Introducing contents command will bring benefits to a bunch of 1st party actions.
A few examples:

It doesn't make much sense to implement this logic in every action. It would be great to have ability to read files via simple expression:

uses: setup-java@v1
with:
  java-version: {{ contents('.java-version') }}
uses: setup-node@v1
with:
  node-version: {{ contents('.nvmrc') }}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions