Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle GitHub Action inputs that can have multiple values #951

Merged
merged 2 commits into from Mar 20, 2024

Conversation

tevanoff
Copy link
Contributor

@tevanoff tevanoff commented Mar 15, 2024

The syntax we currently propose for passing multiple values to an input in the GitHub Action is as follows:

externals: |
  - '*.sass'
  - 'public/**'

But that will be parsed into a single string with multiple lines that looks like this:

"- '*.sass'\n
- 'public/**'"

That won't behave as expected when passed along to the CLI.

The correct syntax for this should be like so:

externals: |
  *.sass
  public/**

That, along with the changes in this PR to use getMultilineInput to get those values will give us an array like we need:

["*.sass", "public/**"]

That can be passed along to the CLI, which expects a string[] for these inputs.

How to test
This has been published as chromaui/action-canary@v1 and the CLI canary is below.

Try this out with no values for the inputs, a single value for externals, and multiple values with the new syntax for externals.

📦 Published PR as canary version: 11.1.2--canary.951.8351878886.0

✨ Test out this PR locally via:

npm install chromatic@11.1.2--canary.951.8351878886.0
# or 
yarn add chromatic@11.1.2--canary.951.8351878886.0

Copy link

codacy-production bot commented Mar 18, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (680fb90) 8439 6640 78.68%
Head commit (2593eba) 8439 (+0) 6640 (+0) 78.68% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#951) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

@tevanoff tevanoff marked this pull request as ready for review March 19, 2024 20:37
@tevanoff tevanoff added release Auto: Create a `latest` release when merged patch Auto: Increment the patch version when merged labels Mar 19, 2024
@ghengeveld ghengeveld added this pull request to the merge queue Mar 20, 2024
Merged via the queue into main with commit 55e8043 Mar 20, 2024
27 of 28 checks passed
@ghengeveld ghengeveld deleted the todd/fix-gha-array-inputs branch March 20, 2024 00:14
@ghengeveld
Copy link
Member

🚀 PR was released in v11.1.1 🚀

@ghengeveld ghengeveld added the released Verdict: This issue/pull request has been released label Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Auto: Increment the patch version when merged release Auto: Create a `latest` release when merged released Verdict: This issue/pull request has been released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants