Skip to content

Commit e203925

Browse files
authored
Commit actions/setup/js/ directory to fix sparse checkout workflows (#7389)
1 parent 34dad8e commit e203925

126 files changed

Lines changed: 21619 additions & 23 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
pkg/cli/workflows/*.lock.yml linguist-generated=true merge=ours
66
pkg/workflow/js/*.js linguist-generated=true
77
actions/*/index.js linguist-generated=true
8+
actions/setup/js/*.cjs linguist-generated=true
89

910
.github/workflows/*.campaign.g.md linguist-generated=true merge=ours

.github/workflows/issue-classifier.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/release.lock.yml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/stale-repo-identifier.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/super-linter.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,13 @@ gosec-results.sarif
126126
govulncheck-results.sarif
127127
trivy-results.sarif
128128

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

133137
# License compliance reports
134138
licenses.csv

actions/setup/README.md

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ This action copies workflow script files to the agent environment.
66

77
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.
88

9+
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.
10+
911
## Usage
1012

1113
```yaml
1214
- name: Setup Scripts
1315
uses: ./actions/setup
1416
with:
1517
# Destination directory for script files
16-
# Default: /tmp/gh-aw/actions/activation
17-
destination: /tmp/gh-aw/actions/activation
18+
# Default: /tmp/gh-aw/actions
19+
destination: /tmp/gh-aw/actions
1820
```
1921
2022
## Inputs
@@ -23,35 +25,61 @@ This action runs in all workflow jobs to provide JavaScript scripts that can be
2325

2426
**Optional** Destination directory for script files.
2527

26-
Default: `/tmp/gh-aw/actions/activation`
28+
Default: `/tmp/gh-aw/actions`
2729

2830
## Outputs
2931

3032
### `files-copied`
3133

32-
The number of files copied to the destination directory.
34+
The number of files copied to the destination directory (should be 117).
3335

3436
## Example
3537

3638
```yaml
3739
steps:
3840
- uses: actions/checkout@v4
41+
with:
42+
sparse-checkout: |
43+
actions
3944
4045
- name: Setup Scripts
4146
uses: ./actions/setup
4247
with:
43-
destination: /tmp/gh-aw/actions/activation
48+
destination: /tmp/gh-aw/actions
4449
```
4550

4651
## Files Included
4752

48-
This action copies all .cjs files from the script registry, including:
53+
This action copies 117 `.cjs` files from `actions/setup/js/`, including:
54+
55+
- Activation job scripts (check_stop_time, check_skip_if_match, check_command_position, etc.)
56+
- Agent job scripts (compute_text, create_issue, create_pull_request, etc.)
57+
- Safe output scripts (safe_outputs_*, safe_inputs_*, messages, etc.)
58+
- Utility scripts (sanitize_*, validate_*, generate_*, etc.)
59+
60+
All files are copied from the committed `js/` directory which is populated by running `make actions-build` during development.
61+
62+
## Development
63+
64+
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.
65+
66+
To update the JavaScript files after modifying source files in `pkg/workflow/js/`:
67+
68+
```bash
69+
make actions-build
70+
git add actions/setup/js/
71+
git commit -m "Update action JavaScript files"
72+
```
73+
74+
## Testing Locally
75+
76+
You can test this action locally using the provided test script:
77+
78+
```bash
79+
./test-setup-local.sh
80+
```
4981

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

0 commit comments

Comments
 (0)