Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
pkg/cli/workflows/*.lock.yml linguist-generated=true merge=ours
pkg/workflow/js/*.js linguist-generated=true
actions/*/index.js linguist-generated=true
actions/setup/js/*.cjs linguist-generated=true

.github/workflows/*.campaign.g.md linguist-generated=true merge=ours
2 changes: 1 addition & 1 deletion .github/workflows/issue-classifier.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/workflows/release.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/stale-repo-identifier.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/super-linter.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,13 @@ gosec-results.sarif
govulncheck-results.sarif
trivy-results.sarif

# Generated action files
# Generated action files - kept in .gitignore as build artifacts
# Note: If workflows fail due to missing js/ files, these may need to be committed
# The js/ directories contain compiled JavaScript from pkg/workflow/js/*.cjs
# and are generated by 'make actions-build'
actions/setup-safe-outputs/js/
actions/setup/js/
# Temporarily removed from .gitignore to fix workflow failures:
# actions/setup/js/

# License compliance reports
licenses.csv
56 changes: 42 additions & 14 deletions actions/setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ This action copies workflow script files to the agent environment.

This action runs in all workflow jobs to provide JavaScript scripts that can be required instead of being inlined in the workflow. This includes scripts for activation jobs, agent jobs, and safe-output jobs.

The action copies 117 `.cjs` JavaScript files from the `js/` directory to a destination directory (default: `/tmp/gh-aw/actions`). These files are generated by running `make actions-build` and are committed to the repository.

## Usage

```yaml
- name: Setup Scripts
uses: ./actions/setup
with:
# Destination directory for script files
# Default: /tmp/gh-aw/actions/activation
destination: /tmp/gh-aw/actions/activation
# Default: /tmp/gh-aw/actions
destination: /tmp/gh-aw/actions
```

## Inputs
Expand All @@ -23,35 +25,61 @@ This action runs in all workflow jobs to provide JavaScript scripts that can be

**Optional** Destination directory for script files.

Default: `/tmp/gh-aw/actions/activation`
Default: `/tmp/gh-aw/actions`

## Outputs

### `files-copied`

The number of files copied to the destination directory.
The number of files copied to the destination directory (should be 117).

## Example

```yaml
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
actions

- name: Setup Scripts
uses: ./actions/setup
with:
destination: /tmp/gh-aw/actions/activation
destination: /tmp/gh-aw/actions
```

## Files Included

This action copies all .cjs files from the script registry, including:
This action copies 117 `.cjs` files from `actions/setup/js/`, including:

- 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.)
- Utility scripts (sanitize_*, validate_*, generate_*, etc.)

All files are copied from the committed `js/` directory which is populated by running `make actions-build` during development.

## Development

The `js/` directory contains generated JavaScript files created by `make actions-build`. These files are committed to the repository so that workflows using sparse checkout can access them without needing to rebuild.

To update the JavaScript files after modifying source files in `pkg/workflow/js/`:

```bash
make actions-build
git add actions/setup/js/
git commit -m "Update action JavaScript files"
```

## Testing Locally

You can test this action locally using the provided test script:

```bash
./test-setup-local.sh
```

- `check_stop_time.cjs` - Check stop-time limit script
- `check_skip_if_match.cjs` - Check skip-if-match query script
- `check_command_position.cjs` - Check command position script
- `check_workflow_timestamp_api.cjs` - Check workflow file timestamps script
- `lock-issue.cjs` - Lock issue for agent workflow script
- `compute_text.cjs` - Compute current body text script (bundled with dependencies)
- `add_reaction_and_edit_comment.cjs` - Add reaction and edit comment script (bundled with dependencies)
- And all other registered .cjs files (82 total)
This script will:
1. Check if `js/` directory exists (runs `make actions-build` if needed)
2. Run setup.sh with test configuration
3. Verify all files are copied correctly
Loading