Skip to content

🩹 [Patch]: Improve help text on output when this action is used inside another composite action #55

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 18, 2025

Problem

When the GitHub-Script action is used directly in a workflow, the output help text correctly shows:

${{ fromJson(steps.my-step-id.outputs.result).MyOutput }}

However, when the GitHub-Script action is used inside another composite action, this help text becomes incorrect because users need to reference the outer composite action's step ID, not the internal step ID.

Example of the issue:

# Direct usage (help text is correct)
- uses: PSModule/GitHub-Script@v1
  id: my-script
# Access: ${{ fromJson(steps.my-script.outputs.result).MyOutput }}

# Nested in composite action (help text was wrong)
- uses: my-org/my-composite@v1  # internally uses GitHub-Script
  id: my-composite
# Need: ${{ fromJson(steps.my-composite.outputs.result).MyOutput }}
# But help showed: ${{ fromJson(steps.internal-id.outputs.result).MyOutput }}

Solution

Modified scripts/outputs.ps1 to provide comprehensive help text that covers both scenarios:

When step ID is available:

  • Direct usage: ${{ fromJson(steps.actual-step-id.outputs.result).OutputName }}
  • Nested usage: ${{ fromJson(steps.<your-step-id>.outputs.result).OutputName }}

When step ID is unavailable (fallback):

  • Generic: ${{ fromJson(steps.<step-id>.outputs.result).OutputName }}

Changes Made

  • Enhanced help text generation logic in scripts/outputs.ps1
  • Added conditional display showing both direct and nested usage examples
  • Improved fence line calculation to handle variable text lengths
  • Maintained backward compatibility and existing functionality

Testing

  • ✅ Integration tests confirm both scenarios work correctly
  • ✅ Syntax validation passed for all PowerShell scripts
  • ✅ Edge cases handled (missing GITHUB_ACTION)
  • ✅ Minimal code changes (only modified help text display)

Fixes #54

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.powershellgallery.com
    • Triggering command: pwsh -c Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 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.

@MariusStorhaug
Copy link
Member

Try again

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 🩹 [Patch]: Improve help text on output when this action is used inside another composite action 🩹 [Patch]: Improve help text on output when this action is used inside another composite action Jun 20, 2025
Copilot finished work on behalf of MariusStorhaug June 20, 2025 15:37
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.

🩹 [Patch]: Improve help text on output when this action is used inside another composite action
2 participants