Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 37 additions & 27 deletions .github/workflows/test-claude.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/workflow/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
_ "embed"
)

//go:embed js/create_pull_request.mjs
//go:embed js/create_pull_request.cjs
var createPullRequestScript string

//go:embed js/create_issue.mjs
//go:embed js/create_issue.cjs
var createIssueScript string

//go:embed js/create_comment.mjs
//go:embed js/create_comment.cjs
var createCommentScript string
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,22 @@ async function main() {
return;
}


let body = outputContent.trim();
// Add AI disclaimer with run id, run htmlurl
const runId = context.runId;
const runUrl = `${context.payload.repository.html_url}/actions/runs/${runId}`;
body += `\n\n> Generated by Agentic Workflow Run [${runId}](${runUrl})\n`;

console.log(`Creating comment on ${commentEndpoint} #${issueNumber}`);
console.log('Comment content length:', outputContent.length);
console.log('Comment content length:', body.length);

// Create the comment using GitHub API
const { data: comment } = await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: outputContent
body: body
});

console.log('Created comment #' + comment.id + ': ' + comment.html_url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ async function main() {
console.log('No GITHUB_AW_AGENT_OUTPUT environment variable found');
return;
}

if (outputContent.trim() === '') {
console.log('Agent output content is empty');
return;
}

console.log('Agent output content length:', outputContent.length);
// Check if we're in an issue context (triggered by an issue event)
const parentIssueNumber = context.payload?.issue?.number;
// Parse labels from environment variable (comma-separated string)
const labelsEnv = process.env.GITHUB_AW_ISSUE_LABELS;
const labels = labelsEnv ? labelsEnv.split(',').map(label => label.trim()).filter(label => label) : [];

// Parse the output to extract title and body
const lines = outputContent.split('\n');
Expand Down Expand Up @@ -52,38 +55,33 @@ async function main() {
title = titlePrefix + title;
}

if (parentIssueNumber) {
console.log('Detected issue context, parent issue #' + parentIssueNumber);

// Add reference to parent issue in the child issue body
bodyLines.push(`Related to #${parentIssueNumber}`);
}

// Add AI disclaimer with run id, run htmlurl
// Add AI disclaimer with workflow run information
const runId = context.runId;
const runUrl = `${context.payload.repository.html_url}/actions/runs/${runId}`;
bodyLines.push(``, ``, `> Generated by Agentic Workflow Run [${runId}](${runUrl})`, '');

// Prepare the body content
const body = bodyLines.join('\n').trim();

// Parse labels from environment variable (comma-separated string)
const labelsEnv = process.env.GITHUB_AW_ISSUE_LABELS;
const labels = labelsEnv ? labelsEnv.split(',').map(label => label.trim()).filter(label => label) : [];

console.log('Creating issue with title:', title);
console.log('Labels:', labels);
console.log('Body length:', body.length);

// Check if we're in an issue context (triggered by an issue event)
const parentIssueNumber = context.payload?.issue?.number;
let finalBody = body;

if (parentIssueNumber) {
console.log('Detected issue context, parent issue #' + parentIssueNumber);

// Add reference to parent issue in the child issue body
if (finalBody.trim()) {
finalBody = `Related to #${parentIssueNumber}\n\n${finalBody}`;
} else {
finalBody = `Related to #${parentIssueNumber}`;
}
}

// Create the issue using GitHub API
const { data: issue } = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: finalBody,
body: body,
labels: labels
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const fs = require("fs");
const crypto = require("crypto");
const { execSync } = require("child_process");

async function main() {
// Required Node.js modules
const fs = require('fs');
const crypto = require('crypto');
const { execSync } = require('child_process');

// Environment validation - fail early if required variables are missing
const workflowId = process.env.GITHUB_AW_WORKFLOW_ID;
Expand Down Expand Up @@ -72,6 +72,11 @@ async function main() {
title = titlePrefix + title;
}

// Add AI disclaimer with run id, run htmlurl
const runId = context.runId;
const runUrl = `${context.payload.repository.html_url}/actions/runs/${runId}`;
bodyLines.push(``, ``, `> Generated by Agentic Workflow Run [${runId}](${runUrl})`, '');

// Prepare the body content
const body = bodyLines.join('\n').trim();

Expand Down
9 changes: 6 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "es2022",
"module": "esnext",
"lib": ["es2022", "dom"],
"module": "es2022",
"lib": ["es2022"],
"allowJs": true,
"checkJs": true,
"declaration": false,
Expand Down Expand Up @@ -31,7 +31,10 @@
"typeRoots": ["./node_modules/@types", "./pkg/workflow/js/types"]
},
"include": [
"pkg/workflow/js/**/*"
"pkg/workflow/js/**/*.js",
"pkg/workflow/js/**/*.cjs",
"pkg/workflow/js/**/*.ts",
"pkg/workflow/js/**/*.d.ts"
],
"exclude": [
"node_modules",
Expand Down