Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

The jq action was directly assigning to process.env[env_var] before calling core.exportVariable(), which breaks multiline values since direct assignment doesn't use EOF delimiters.

Changes

  • Removed redundant process.env assignment in src/action.ts line 29

    • core.exportVariable() already handles environment variable persistence correctly with multiline support
  • Added multiline test coverage in __tests__/action.test.ts

    • Verifies exportVariable is called with multiline content
    • Confirms process.env is not directly modified
    • Tests edge cases with empty lines and special characters
  • Updated existing test to expect correct behavior (no direct process.env assignment)

Before

if (env_var) {
  process.env[env_var] = processed_output  // ❌ Doesn't persist, breaks multiline
  core.exportVariable(env_var, processed_output)
}

After

if (env_var) {
  core.exportVariable(env_var, processed_output)  // ✅ Handles multiline with EOF delimiters
}

When jq outputs multiline content, core.exportVariable() writes to GITHUB_ENV with proper delimiters:

MY_VAR<<ghadelimiter_xyz
line1
line2
line3
ghadelimiter_xyz
Original prompt

if you check #3458 there was a bug in the action we just added

im pretty sure this will fix - but can you add a test with multiline input - it should fail on main (without my fix) - ill pick it once ready


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link

netlify bot commented Jan 13, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 2385bae
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/69664f712c12eb0007323f14
😎 Deploy Preview https://deploy-preview-3459--nifty-bassi-e26446.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Remove redundant process.env assignment that doesn't handle multiline values properly. The @actions/core.exportVariable() function already handles environment variable setting with proper EOF delimiters for multiline content.

Add comprehensive test cases for multiline output handling that verify:
- Multiline output with setOutput
- Multiline output with exportVariable
- Special characters in multiline output

Update existing test to reflect that process.env should not be set directly.

Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix multiline input bug in recent action jq: Remove redundant process.env assignment for multiline values Jan 13, 2026
Copilot AI requested a review from phlax January 13, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants