Skip to content

Commit ac1a50d

Browse files
test: handle GITHUB_ACTOR environment variable in executeAction tests
1 parent 1707ba2 commit ac1a50d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/action-execution.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises';
2+
import process from 'node:process';
23
import { tmpdir } from 'node:os';
34
import path from 'node:path';
45
import { describe, expect, it, beforeEach, vi } from 'vitest';
@@ -236,6 +237,9 @@ describe('executeAction failure modes', () => {
236237
await mkdir(workflowsDir, { recursive: true });
237238
await writeFile(path.join(workflowsDir, 'ci.yml'), 'python-version: "3.13.0"\n');
238239

240+
const originalActor = process.env.GITHUB_ACTOR;
241+
process.env.GITHUB_ACTOR = '';
242+
239243
try {
240244
const result = await executeAction(
241245
{
@@ -260,6 +264,11 @@ describe('executeAction failure modes', () => {
260264
}),
261265
);
262266
} finally {
267+
if (originalActor === undefined) {
268+
delete process.env.GITHUB_ACTOR;
269+
} else {
270+
process.env.GITHUB_ACTOR = originalActor;
271+
}
263272
await rm(workspace, { recursive: true, force: true });
264273
}
265274
});

0 commit comments

Comments
 (0)