actions / actions/toolkit

Add option to prevent removing empty lines in getMultilineInput

Open
#1,231 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the enhancement

The getMultilineInput function currently uses a filter to remove empty lines from the input.

It would be convenient to disable this behavior since the empty lines could be from a pre-formatted string. (For example, my use case is creating a comment with output from Terraform. Since empty lines are removed, the output is much less readable).

There is a workaround, which is to use the getInput function, but it would be convenient to have this behavior built in to the getMultilineInput function itself.

Code Snippet

For example, if there was an option added called filterEmptyLines of type boolean, it could be used like

import * as core from "@actions/core"

const strWithEmptyLines = core.getMultilineInput("my_string", { filterEmptyLines: false })

Doing it this way will make the behavior opt-in and backwards compatible.

Happy to do a PR for this :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at packages/core/src/core.ts around the getMultilineInput implementation linked in the issue. Review how its current filtering handles empty lines and the surrounding public API before checking the existing core package tests. Done means an option can preserve empty lines while the default behavior remains backward compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, developer-experience
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.