Skip to content

Commit 6cc49d9

Browse files
committed
fix(ci): rename the cross-repo client — github-script already declares octokit
`actions/github-script` injects an `octokit` binding into the script scope, so `const octokit = ...` aborts the run before any logic executes: SyntaxError: Identifier 'octokit' has already been declared Caught on objectstack#4553's own merge — the first time the workflow ever ran. The pre-merge `node --check` missed it because the test wrapper declared only {github, context, core, require}; a wrapper that omits an injected identifier cannot see a collision with it. The wrapper now carries the full injected set, and the old spelling fails that check.
1 parent 76515a5 commit 6cc49d9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/cross-repo-issue-closer.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,25 @@ jobs:
105105
106106
// A second client: `github` is bound to GITHUB_TOKEN, which has no
107107
// write access outside this repository.
108-
const octokit = require('@actions/github').getOctokit(token);
108+
const crossRepo = require('@actions/github').getOctokit(token);
109109
110110
for (const [key, t] of targets) {
111111
try {
112-
const { data: issue } = await octokit.rest.issues.get({
112+
const { data: issue } = await crossRepo.rest.issues.get({
113113
owner: t.owner, repo: t.repo, issue_number: t.number,
114114
});
115115
if (issue.state === 'closed') {
116116
core.info(`${key} is already closed — skipping.`);
117117
continue;
118118
}
119-
await octokit.rest.issues.createComment({
119+
await crossRepo.rest.issues.createComment({
120120
owner: t.owner, repo: t.repo, issue_number: t.number,
121121
body:
122122
`已由 ${thisRepo} 的 ${prUrl} 修复并合并。\n\n` +
123123
`(跨仓库的关闭关键字不会自动生效,本条由 \`cross-repo-issue-closer\` 工作流代为收口。)\n\n` +
124124
`---\n_Generated by [Claude Code](https://claude.ai/code)_`,
125125
});
126-
await octokit.rest.issues.update({
126+
await crossRepo.rest.issues.update({
127127
owner: t.owner, repo: t.repo, issue_number: t.number,
128128
state: 'closed', state_reason: 'completed',
129129
});

0 commit comments

Comments
 (0)