Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

The push_repo_memory step was inlining ~200 lines of JavaScript in every compiled workflow lock file. This change moves it to use the require pattern like other scripts in the codebase.

Changes

  • pkg/workflow/repo_memory.go: Modified buildPushRepoMemoryJob() to use require('/tmp/gh-aw/actions/push_repo_memory.cjs') when setup action is available, falling back to inline script otherwise
  • pkg/workflow/repo_memory_integration_test.go: Updated test to verify require statement presence instead of checking for inline validation messages
  • 17 workflow lock files: Reduced from inline script to require pattern

Before/After

Before (~200 lines per workflow):

with:
  script: |
    const fs = require("fs");
    const path = require("path");
    const { execSync } = require("child_process");
    async function main() {
      // ... 200+ lines of validation and git logic
    }
    module.exports = { main };

After (7 lines):

with:
  script: |
    global.core = core;
    global.github = github;
    global.context = context;
    global.exec = exec;
    global.io = io;
    const { main } = require('/tmp/gh-aw/actions/push_repo_memory.cjs');
    await main();

The JavaScript file at actions/setup/js/push_repo_memory.cjs was already present and unchanged.

Net impact: -1,899 lines across all lock files

Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/20485924806/job/58868843921#step:7:1

Move JavaScript file to actions/setup and use require action mode in step.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 24, 2025 13:12
- Modified buildPushRepoMemoryJob to use require pattern
- Updated test to check for environment variables and require statement
- All workflows now use require('/tmp/gh-aw/actions/push_repo_memory.cjs')
- JavaScript file already exists in actions/setup/js/

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Verified all 13 workflows with repo-memory now use require pattern
- No workflows have inline push_repo_memory script anymore
- JavaScript file contains validation logic
- Test updated to verify require statement and environment variables
- Change follows the same pattern as other scripts (check_workflow_timestamp_api, checkout_pr_branch)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Move JavaScript file to actions/setup and use require action mode Move push_repo_memory script from inline to require action mode Dec 24, 2025
Copilot AI requested a review from pelikhan December 24, 2025 13:23
@pelikhan pelikhan marked this pull request as ready for review December 24, 2025 15:02
@pelikhan pelikhan merged commit 70abadf into main Dec 24, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/move-js-file-to-setup branch December 24, 2025 15:03
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