@dapplion/benchmark
Version:
Ensures that new code does not introduce performance regressions with CI. Tracks:
20 lines (19 loc) • 744 B
JavaScript
import * as github from "@actions/github";
import { getGithubEventData, parseBranchFromRef } from "../utils/index.js";
import { isGaRun } from "../github/context.js";
import { shell } from "./shell.js";
export async function getCurrentBranch() {
if (isGaRun()) {
switch (github.context.eventName) {
case "pull_request": {
const eventData = getGithubEventData();
return eventData.pull_request.head.ref; // base.ref is already parsed
}
case "push": {
return parseBranchFromRef(github.context.ref);
}
}
}
const refStr = github.context.ref || (await shell("git symbolic-ref HEAD"));
return parseBranchFromRef(refStr);
}