MCPcopy Create free account
hub / github.com/alibaba/open-code-review / runPrRefs

Function runPrRefs

scripts/github-actions/action-contract.test.js:374–395  ·  view source on GitHub ↗
(sources)

Source from the content-addressed store, hash-verified

372// way the runner would have rendered them for a given event, and the precedence
373// between them — the part that is actually under test — runs as written.
374function runPrRefs(sources) {
375 const fixture = makeFixture();
376 try {
377 const env = Object.assign(
378 {
379 INPUT_BASE_REF: "",
380 INPUT_HEAD_SHA: "",
381 INPUT_PR_NUMBER: "",
382 EVENT_BASE_REF: "main",
383 EVENT_HEAD_SHA: "a".repeat(40),
384 EVENT_PR_NUMBER: "",
385 WORKFLOW_RUN_PR_NUMBER: "",
386 GITHUB_EVENT_NAME: "workflow_run",
387 },
388 sources
389 );
390 const result = runShell(renderedRun(prRefsStep(), inputValues()), env, fixture);
391 return { result, exported: readEnvAssignments(path.join(fixture.dir, "github-env")) };
392 } finally {
393 removeFixture(fixture);
394 }
395}
396
397function testPrNumberInputIsOptionalAndDocumented() {
398 assert.ok(INPUTS.pr_number, "action.yml must define the pr_number input");

Calls 7

makeFixtureFunction · 0.85
runShellFunction · 0.85
renderedRunFunction · 0.85
prRefsStepFunction · 0.85
inputValuesFunction · 0.85
readEnvAssignmentsFunction · 0.85
removeFixtureFunction · 0.85

Tested by

no test coverage detected