Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 27, 2025

The close-expired-discussions and close-expired-issues jobs were failing because they require JavaScript modules from /tmp/gh-aw/actions/ without first copying them to the runner.

Changes

  • pkg/workflow/action_reference.go:

    • Added ResolveSetupActionReference() shared helper function to resolve actions/setup references based on action mode and version
    • Updated Compiler.resolveActionReference() to use the shared helper for ./actions/setup references
    • Provides single source of truth for actions/setup reference resolution
  • pkg/workflow/maintenance_workflow.go:

    • Updated GenerateMaintenanceWorkflow() to accept version and actionMode parameters
    • Added checkout and setup steps to both maintenance jobs with dynamic action reference resolution
    • Now uses shared ResolveSetupActionReference() helper (eliminates code duplication)
  • pkg/workflow/compiler_types.go: Added GetVersion() method to Compiler for consistency

  • pkg/cli/compile_orchestrator.go: Updated to pass compiler version and action mode to maintenance workflow generation

  • .github/workflows/agentics-maintenance.yml: Regenerated workflow with new steps

Both jobs now follow the standard pattern used throughout the codebase and support both dev and release modes. The shared helper function is used by safe outputs, activation jobs, and maintenance workflow generation for consistent behavior.

Dev Mode (local development):

steps:
  - name: Checkout actions folder
    uses: actions/checkout@<sha>
    with:
      sparse-checkout: |
        actions
      persist-credentials: false

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

  - name: Close expired discussions  # or issues
    uses: actions/github-script@<sha>
    with:
      script: |
        const { setupGlobals } = require('/tmp/gh-aw/actions/setup_globals.cjs');
        // ...

Release Mode (production):

steps:
  - name: Setup Scripts
    uses: githubnext/gh-aw/actions/setup@v1.2.3
    with:
      destination: /tmp/gh-aw/actions

  - name: Close expired discussions  # or issues
    uses: actions/github-script@<sha>
    with:
      script: |
        const { setupGlobals } = require('/tmp/gh-aw/actions/setup_globals.cjs');
        // ...

This ensures JavaScript files are available before require() statements execute in both development and production environments, with a single shared implementation used across safe outputs, activation jobs, and maintenance workflow.

Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/20531767155/job/58984073729

Agentics mantenance must also add steps to include actions/setup in each job


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

Both close-expired-discussions and close-expired-issues jobs now include:
- Checkout actions folder step
- Setup Scripts step to copy files to /tmp/gh-aw/actions/

This ensures the required JavaScript files are available before they are required by github-script actions.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add actions/setup step to each job Add actions/setup steps to maintenance workflow jobs Dec 27, 2025
Copilot AI requested a review from pelikhan December 27, 2025 00:48
permissions:
discussions: write
steps:
- name: Checkout actions folder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot must handle the release mode where it references the release tag like the safe outputs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cb04104. The maintenance workflow now handles both dev and release modes:

Dev mode: Uses ./actions/setup with checkout step
Release mode: Uses githubnext/gh-aw/actions/setup@<version> without checkout

The implementation follows the same pattern used in safe outputs and other jobs throughout the codebase.

- Add version and actionMode parameters to GenerateMaintenanceWorkflow()
- Add resolveSetupActionRef() helper to determine action reference based on mode
- In dev mode: use ./actions/setup with checkout step
- In release mode: use githubnext/gh-aw/actions/setup@version without checkout
- Add GetVersion() method to Compiler for consistency
- Update compile orchestrator to pass compiler version and action mode

This ensures the maintenance workflow uses the correct action reference
whether running in development or release mode, matching the pattern
used throughout the codebase for safe outputs and other jobs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot extract helper to resolve the current action mode and path so that it is used in safe outputs and in agentics maintenance.

Copilot AI changed the title Add actions/setup steps to maintenance workflow jobs Add actions/setup steps to maintenance workflow jobs with release mode support Dec 27, 2025
Copilot AI requested a review from pelikhan December 27, 2025 01:06
- Move resolveSetupActionRef logic from maintenance_workflow.go to action_reference.go
- Rename to ResolveSetupActionReference (public) for shared use
- Update Compiler.resolveActionReference to use shared helper for "./actions/setup"
- Update GenerateMaintenanceWorkflow to use ResolveSetupActionReference

This eliminates code duplication and provides a single source of truth for
resolving actions/setup references across both the Compiler (safe outputs,
activation jobs, etc.) and standalone workflow generators (maintenance workflow).

The shared helper is now used by:
- Compiler.resolveActionReference (for safe outputs and other jobs)
- GenerateMaintenanceWorkflow (for maintenance workflow generation)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 27, 2025

@copilot extract helper to resolve the current action mode and path so that it is used in safe outputs and in agentics maintenance.

Done in ec153e1. Extracted ResolveSetupActionReference() as a shared helper function in action_reference.go that is now used by:

  1. Compiler.resolveActionReference() - for safe outputs, activation jobs, and other compiler-generated jobs
  2. GenerateMaintenanceWorkflow() - for maintenance workflow generation

This eliminates code duplication and provides a single source of truth for resolving actions/setup references across the codebase.

Copilot AI changed the title Add actions/setup steps to maintenance workflow jobs with release mode support Add actions/setup steps to maintenance workflow jobs with release mode support and shared helper Dec 27, 2025
@pelikhan pelikhan marked this pull request as ready for review December 27, 2025 01:19
@pelikhan pelikhan merged commit 2896761 into main Dec 27, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/add-setup-action-to-jobs branch December 27, 2025 01:20
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