Setup Action
This action copies workflow script files to the agent environment.
Description
This action runs in all workflow jobs to provide scripts that can be used instead of being inlined in the workflow. This includes scripts for activation jobs, agent jobs, and safe-output jobs.
The action copies runtime .cjs JavaScript files (excluding tests) from the js/ directory and .sh shell scripts from the sh/ directory.
All files are copied to the destination directory (default: ${{ runner.temp }}/gh-aw/actions). These files are generated by running make actions-build and are committed to the repository.
Usage
- name: Setup Scripts
uses: ./actions/setup
with:
# Destination directory for script files
# Default: ${{ runner.temp }}/gh-aw/actions
destination: ${{ runner.temp }}/gh-aw/actions
destination
Optional Destination directory for script files.
Default: ${{ runner.temp }}/gh-aw/actions
Outputs
files-copied
The number of runtime JavaScript, JSON, and shell files copied to the destination directory.
Example
steps:
- uses: actions/checkout@v7
with:
sparse-checkout: |
actions
- name: Setup Scripts
uses: ./actions/setup
with:
destination: ${{ runner.temp }}/gh-aw/actions
Files Included
This action copies files from actions/setup/, including:
JavaScript Files
- Activation job scripts (check_stop_time, check_skip_if_match, check_command_position, etc.)
- Agent job scripts (compute_text, create_issue, create_pull_request, etc.)
- Safe output scripts (safe_outputs_, safe_inputs_, messages, etc.)
- Prompt rendering scripts (
create_prompt.cjs, interpolate_prompt.cjs, etc.)
- Utility scripts (sanitize_, validate_, generate_*, etc.)
Shell Scripts (7 files from sh/)
create_gh_aw_tmp_dir.sh - Creates temporary directory structure
start_mcp_scripts_server.sh - Starts MCP Scripts HTTP server
print_prompt_summary.sh - Prints prompt summary to logs
generate_git_patch.sh - Generates git patches
create_cache_memory_dir.sh - Creates cache-memory directory
validate_multi_secret.sh - Validates that at least one secret from a list is configured
All files are copied from the committed js/ and sh/ directories which contain the source of truth for all JavaScript and shell scripts.
Development
The js/ and sh/ directories contain the source of truth for all JavaScript and shell script files. These files are manually edited and committed to the repository.
To update JavaScript files:
# Edit files in actions/setup/js/
# Format the JavaScript files
make fmt-cjs
# Lint the JavaScript files
make lint-cjs
# Commit the changes
git add actions/setup/js/
git commit -m "Update JavaScript files"
To update shell scripts:
# Edit files in actions/setup/sh/
# Commit the changes
git add actions/setup/sh/
git commit -m "Update shell scripts"
Note: JavaScript and shell files are NOT embedded in the binary. They are copied at runtime by setup.sh from actions/setup/js/ and actions/setup/sh/ to ${{ runner.temp }}/gh-aw/actions where workflows can access them.
Testing Locally
You can test this action locally using the provided test script:
./test-setup-local.sh
This script will:
- Check if
js/ directory exists (runs make actions-build if needed)
- Run setup.sh with test configuration
- Verify all files are copied correctly