Skip to content

Fix agentics-maintenance.yml syntax by updating generator to use bundler#5792

Merged
pelikhan merged 4 commits intomainfrom
copilot/fix-workflow-syntax-errors
Dec 7, 2025
Merged

Fix agentics-maintenance.yml syntax by updating generator to use bundler#5792
pelikhan merged 4 commits intomainfrom
copilot/fix-workflow-syntax-errors

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

The workflow file had critical YAML parsing errors preventing execution. Instead of manually editing the generated file, this PR fixes the source code that generates it.

Changes:

  1. Fixed source JavaScript file (pkg/workflow/js/close_expired_discussions.cjs):

    • Changed /// <reference types="@actions/github-script" /> to // <reference types="@actions/github-script" />
    • This was the root cause of the YAML syntax error
  2. Updated workflow generator (pkg/workflow/maintenance_workflow.go):

    • Replaced manual fmt.Sprintf() template with strings.Builder and bundler helper
    • Now uses WriteJavaScriptToYAML() for proper formatting
    • Automatically handles indentation (12 spaces) and comment removal
    • Consistent with how other workflows are generated in the codebase
  3. Generated workflow (.github/workflows/agentics-maintenance.yml):

    • Now properly generated using bundler infrastructure
    • JavaScript is correctly indented
    • Comments are automatically stripped (including TypeScript-specific directives)
    • Passes YAML validation ✅

Before:

script: |
  // @ts-check
/// <reference types="@actions/github-script" />

/**
 * Maximum number of discussions to update per run
 */
const MAX_UPDATES_PER_RUN = 100;

After:

script: |
  const MAX_UPDATES_PER_RUN = 100;
  const GRAPHQL_DELAY_MS = 500;
  function delay(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
  }
  ...

The workflow now passes YAML validation and can execute successfully. Future changes to the JavaScript source will be automatically formatted correctly.

Original prompt

Investigate .github/workflows/agentics-maintenance.yml failures, fix syntax, add name.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 7, 2025 22:01
- Change /// to // on TypeScript reference directive (line 21)
- Fix indentation of entire JavaScript block to match YAML structure
- Remove trailing spaces on lines with 'comment {', 'id', 'url', 'discussion {'
- Remove extra blank line at end of file
- Verify workflow name exists: "Agentics Maintenance" ✓

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fix excessive indentation (24 spaces) on first JSDoc comment block to match
the consistent 12-space indentation used throughout the JavaScript code.

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

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

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

@copilot fix the code that generates this file. Use helpers/bundler to write JavaScript.

Copilot AI changed the title [WIP] Fix syntax in agentics-maintenance.yml and add name Fix YAML syntax errors in agentics-maintenance.yml Dec 7, 2025
Copilot AI requested a review from pelikhan December 7, 2025 22:07
- Changed /// to // in close_expired_discussions.cjs source file
- Updated maintenance_workflow.go to use WriteJavaScriptToYAML helper
- This properly formats JS with indentation and removes comments
- Generated workflow now has valid YAML syntax

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

Copilot AI commented Dec 7, 2025

@copilot fix the code that generates this file. Use helpers/bundler to write JavaScript.

Fixed in commit ed8ffad. Updated the source JavaScript file (pkg/workflow/js/close_expired_discussions.cjs) to use // <reference...> instead of ///, and modified pkg/workflow/maintenance_workflow.go to use the WriteJavaScriptToYAML() bundler helper for proper formatting and comment removal.

Copilot AI changed the title Fix YAML syntax errors in agentics-maintenance.yml Fix agentics-maintenance.yml syntax by updating generator to use bundler Dec 7, 2025
@pelikhan pelikhan marked this pull request as ready for review December 7, 2025 22:27
@pelikhan pelikhan merged commit c32cb84 into main Dec 7, 2025
5 checks passed
@pelikhan pelikhan deleted the copilot/fix-workflow-syntax-errors branch December 7, 2025 22:27
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