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
12 changes: 9 additions & 3 deletions .github/workflows/test-claude.lock.yml

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

45 changes: 45 additions & 0 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"devDependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.1",
"@actions/glob": "^0.4.0",
"@actions/io": "^1.1.3",
"@types/node": "^24.3.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
Expand Down
4 changes: 3 additions & 1 deletion pkg/workflow/js/create_comment.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ async function main() {
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}`;
const runUrl = context.payload.repository
? `${context.payload.repository.html_url}/actions/runs/${runId}`
: `https://github.com/actions/runs/${runId}`;
body += `\n\n> Generated by Agentic Workflow Run [${runId}](${runUrl})\n`;

console.log(`Creating comment on ${commentEndpoint} #${issueNumber}`);
Expand Down
4 changes: 3 additions & 1 deletion pkg/workflow/js/create_issue.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ async function main() {
// 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}`;
const runUrl = context.payload.repository
? `${context.payload.repository.html_url}/actions/runs/${runId}`
: `https://github.com/actions/runs/${runId}`;
bodyLines.push(``, ``, `> Generated by Agentic Workflow Run [${runId}](${runUrl})`, '');

// Prepare the body content
Expand Down
4 changes: 3 additions & 1 deletion pkg/workflow/js/create_pull_request.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ async function main() {

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

// Prepare the body content
Expand Down
53 changes: 47 additions & 6 deletions pkg/workflow/js/types/github-script.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,57 @@
// Type definitions for GitHub Actions github-script action
// These globals are provided by the github-script action environment
// Based on @actions/github-script AsyncFunctionArguments interface

import * as core from '@actions/core';
import * as github from '@actions/github';
import * as __actionsCore from '@actions/core';
import * as __actionsExec from '@actions/exec';
import * as __actionsGithub from '@actions/github';
import * as __actionsGlob from '@actions/glob';
import * as __actionsIo from '@actions/io';
import type { Context } from '@actions/github/lib/context';
import type { GitHub } from '@actions/github/lib/utils';

declare global {
/**
* GitHub API client instance provided by github-script action
* This is an authenticated Octokit instance with pagination plugins
*/
const github: ReturnType<typeof github.getOctokit>;
const github: InstanceType<typeof GitHub>;

/**
* Alternative name for the github client (same as github)
* Provided for backward compatibility
*/
const octokit: InstanceType<typeof GitHub>;

/**
* GitHub Actions context object provided by github-script action
* Contains information about the workflow run context
*/
const context: typeof github.context;
const context: Context;

/**
* Actions core utilities provided by github-script action
* For setting outputs, logging, and other workflow operations
*/
const core: typeof __actionsCore;

/**
* Actions exec utilities provided by github-script action
* For executing shell commands and tools
*/
const core: typeof core;
const exec: typeof __actionsExec;

/**
* Actions glob utilities provided by github-script action
* For file pattern matching and globbing
*/
const glob: typeof __actionsGlob;

/**
* Actions io utilities provided by github-script action
* For file and directory operations
*/
const io: typeof __actionsIo;

/**
* Console object for logging (available in Node.js environment)
Expand All @@ -31,10 +64,18 @@ declare global {
const process: NodeJS.Process;

/**
* Require function for CommonJS modules
* Enhanced require function for CommonJS modules
* This is a proxy wrapper around the normal Node.js require
* that enables requiring relative paths and npm packages
*/
const require: NodeRequire;

/**
* Original require function without the github-script wrapper
* Use this if you need the non-wrapped require functionality
*/
const __original_require__: NodeRequire;

/**
* Global exports object for CommonJS modules
*/
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"typeRoots": ["./node_modules/@types", "./pkg/workflow/js/types"]
},
"include": [
"pkg/workflow/js/add_labels.cjs",
"pkg/workflow/js/create_comment.cjs",
"pkg/workflow/js/create_issue.cjs",
"pkg/workflow/js/create_pull_request.cjs",
Expand Down
Loading