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

Function runPrRefs

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

Source from the content-addressed store, hash-verified

385// way the runner would have rendered them for a given event, and the precedence
386// between them — the part that is actually under test — runs as written.
387function runPrRefs(sources) {
388 const fixture = makeFixture();
389 try {
390 const env = Object.assign(
391 {
392 INPUT_BASE_REF: "",
393 INPUT_HEAD_SHA: "",
394 INPUT_PR_NUMBER: "",
395 EVENT_BASE_REF: "main",
396 EVENT_HEAD_SHA: "a".repeat(40),
397 EVENT_PR_NUMBER: "",
398 WORKFLOW_RUN_PR_NUMBER: "",
399 GITHUB_EVENT_NAME: "workflow_run",
400 },
401 sources
402 );
403 const result = runShell(renderedRun(prRefsStep(), inputValues()), env, fixture);
404 return { result, exported: readEnvAssignments(path.join(fixture.dir, "github-env")) };
405 } finally {
406 removeFixture(fixture);
407 }
408}
409
410function testPrNumberInputIsOptionalAndDocumented() {
411 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