Skip to content

Allow target of add-issue-comment#275

Merged
dsyme merged 3 commits intomainfrom
so11
Sep 2, 2025
Merged

Allow target of add-issue-comment#275
dsyme merged 3 commits intomainfrom
so11

Conversation

@dsyme
Copy link
Copy Markdown
Collaborator

@dsyme dsyme commented Sep 2, 2025

Summary
I have successfully implemented the [target](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) configuration option for add-issue-comment in GitHub Agentic Workflows. Here's what was added:

📋 Features Implemented
New [target](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) configuration field for both singular and plural forms:

add-issue-comment: { target: "*" }
add-issue-comments: { target: "123", max: 3 }
Three target options supported:

"triggering" (default): Comments only on the triggering issue/PR
"*": Comments on any issue (requires [issue_number](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) in agent output)
"123" (explicit number): Comments on specific issue #123
Dynamic job conditions:

When [target: "*"](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html): Job uses if: always() to run in any context
Otherwise: Job uses if: github.event.issue.number || github.event.pull_request.number
🔧 Code Changes Made
Data Structure Updates:

Added Target field to AddIssueCommentsConfig struct
Updated parseCommentsConfig() to parse the target field
Schema Updates:

Updated JSON schema to allow [target](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) property in both singular and plural forms
Added proper descriptions for each target option
Compilation Updates:

Modified job generation to pass target configuration as environment variable
Updated safe-outputs config to include target information
Dynamic job condition generation based on target value
JavaScript Updates:

Enhanced [create_comment.cjs](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) to handle target configuration
Added logic for explicit issue number handling
Support for [issue_number](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) field in agent output when target is "*"
Documentation Updates:

Updated [safe-outputs.md](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) with new target configuration examples
Added clear descriptions of all three target modes
🧪 Tests Added
Unit Tests:

[TestOutputCommentConfigTargetParsing](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html): Tests parsing of target configuration
[TestOutputCommentPluralTargetParsing](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html): Tests plural form with target
Integration Testing:

Created example workflows for both wildcard (*) and explicit target scenarios
Verified compiled workflows generate correct job conditions and environment variables
📁 Example Usage
Wildcard target ([example-comment-target.md](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html)):

Explicit target ([example-comment-explicit.md](vscode-file://vscode-app/c:/Users/dsyme/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html)):

✅ Verification Results
✅ All existing tests pass
✅ New tests pass
✅ Schema validation works correctly
✅ Compilation generates correct workflows
✅ Job conditions adapt based on target configuration
✅ Environment variables are properly passed
The implementation maintains full backward compatibility while adding the requested flexibility for commenting on different issues beyond just the triggering one.

@dsyme dsyme requested a review from pelikhan September 2, 2025 20:19
@dsyme dsyme merged commit 1bebe98 into main Sep 2, 2025
8 checks passed
@dsyme dsyme deleted the so11 branch September 2, 2025 20: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.

1 participant