Skip to content

feat: Add workflow_dispatch event with script parameters and update trace output to GITHUB_STEP_SUMMARY #1821

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 3 commits into
base: dev
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 3, 2025

This PR enhances the GitHub Action template generation to include workflow_dispatch events with script parameters as inputs and updates the trace output to use $GITHUB_STEP_SUMMARY.

Changes Made

1. Added workflow_dispatch Event with Script Parameters

The generated workflow templates now include a workflow_dispatch trigger alongside the original event (push, pull_request, etc.), allowing users to manually trigger actions with custom inputs:

on:
    push:  # Original event preserved
    workflow_dispatch:
        inputs:
            input_text:
                description: "Input text to process"
                type: string
                required: false
                default: "Hello World"
            files:
                description: "Files to process, separated by semi columns (;)"
                type: string
                required: false
            debug:
                description: "Enable debug logging"
                type: boolean
                required: false
                default: false

2. Updated Trace Output to GITHUB_STEP_SUMMARY

Changed the start command in package.json from --out-output to --out-trace to properly send trace output to GitHub's step summary:

"start": "genaiscript run script --github-workspace --no-run-trace --no-output-trace --out-trace $GITHUB_STEP_SUMMARY"

3. Enhanced Workflow Step to Use Dispatch Inputs

The action step now conditionally uses workflow_dispatch inputs when the workflow is manually triggered:

- uses: owner/repo@v0
  with:
    input_text: ${{ github.event_name == 'workflow_dispatch' && inputs.input_text || '' }}
    debug: ${{ github.event_name == 'workflow_dispatch' && inputs.debug || '' }}
    github_token: ${{ secrets.GITHUB_TOKEN }}

Security Considerations

The implementation excludes sensitive configuration inputs (API keys, endpoints, credentials) from workflow_dispatch inputs for security, while still including them as commented examples in the workflow template.

Testing

  • ✅ Tested with simple scripts (no parameters)
  • ✅ Tested with parameterized scripts using script({ parameters: {...} })
  • ✅ Verified backward compatibility with existing action generation
  • ✅ Validated that trace output correctly uses $GITHUB_STEP_SUMMARY

This enhancement allows users to manually trigger GenAIScript actions with custom parameters while maintaining the existing automated trigger functionality.

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:

  • cdn.sheetjs.com
    • Triggering command: node /home/REDACTED/.local/share/pnpm/.tools/pnpm/10.12.3/bin/pnpm install --frozen-lockfile (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
    • Triggering command: node /home/REDACTED/.local/share/pnpm/.tools/pnpm/10.12.3/bin/pnpm install --frozen-lockfile (dns block)
  • https://api.github.com/markdown
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/branches
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/contents/README.md
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/contents/packages%2Fcore%2Fsrc
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/git/blobs
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/git/ref/heads%2Ftest-ignore
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/issues
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/labels
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/languages
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/pulls
    • Triggering command: node (vitest 3) (http block)
  • https://api.github.com/repos/microsoft/genaiscript/pulls/999999
    • Triggering command: node (vitest 3) (http block)
  • microsoft.github.io
    • Triggering command: node (vitest 2) (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.

@Copilot Copilot AI changed the title [WIP] When generating sample workflows for action.yml (see templates in action.ts), also generate a workflow_dispatch event with the prompt arguments. Update template to send the output trace to $GITHUB_STEP_SUMMARY feat: Add workflow_dispatch event with script parameters and update trace output to GITHUB_STEP_SUMMARY Aug 3, 2025
Copilot finished work on behalf of pelikhan August 3, 2025 06:14
@Copilot Copilot AI requested a review from pelikhan August 3, 2025 06:14
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