Skip to content

Commit 25e2c0d

Browse files
authored
Merge branch 'main' into campaign-orchestrator
2 parents 5eb7c3b + c2039e4 commit 25e2c0d

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

pkg/workflow/js.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ var loadAgentOutputScript string
115115
//go:embed js/lock-issue.cjs
116116
var lockIssueScript string
117117

118+
//go:embed js/unlock-issue.cjs
119+
var unlockIssueScript string
120+
118121
//go:embed js/staged_preview.cjs
119122
var stagedPreviewScript string
120123

@@ -282,6 +285,7 @@ func GetJavaScriptSources() map[string]string {
282285
"sanitize_workflow_name.cjs": sanitizeWorkflowNameScript,
283286
"load_agent_output.cjs": loadAgentOutputScript,
284287
"lock-issue.cjs": lockIssueScript,
288+
"unlock-issue.cjs": unlockIssueScript,
285289
"staged_preview.cjs": stagedPreviewScript,
286290
"assign_agent_helpers.cjs": assignAgentHelpersScript,
287291
"safe_output_helpers.cjs": safeOutputHelpersScript,

pkg/workflow/js/unlock-issue.cjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// @ts-check
2+
/// <reference types="@actions/github-script" />
3+
4+
/**
5+
* Unlock a GitHub issue
6+
* This script is used in the conclusion job to ensure the issue is unlocked
7+
* after agent workflow execution completes or fails
8+
*/
9+
10+
async function main() {
11+
// Get issue number from context
12+
const issueNumber = context.issue.number;
13+
14+
if (!issueNumber) {
15+
core.setFailed("Issue number not found in context");
16+
return;
17+
}
18+
19+
const owner = context.repo.owner;
20+
const repo = context.repo.repo;
21+
22+
core.info(`Unlocking issue #${issueNumber} after agent workflow execution`);
23+
24+
try {
25+
// Unlock the issue
26+
await github.rest.issues.unlock({
27+
owner,
28+
repo,
29+
issue_number: issueNumber,
30+
});
31+
32+
core.info(`✅ Successfully unlocked issue #${issueNumber}`);
33+
} catch (error) {
34+
const errorMessage = error instanceof Error ? error.message : String(error);
35+
core.error(`Failed to unlock issue: ${errorMessage}`);
36+
core.setFailed(`Failed to unlock issue #${issueNumber}: ${errorMessage}`);
37+
}
38+
}
39+
40+
await main();

0 commit comments

Comments
 (0)