mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(ci): bind timing history to the verified workflow source (#12555)
* fix(ci): bind timing history to the verified workflow source * test(ci): reject timing history without valid commit lineage --------- Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
2 files changed
+40
No files matched your search
@@ -11,6 +11,7 @@ const TIER_PROFILES = {
|
||||
};
|
||||
const MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
||||
const MAX_CANDIDATES = 5;
|
||||
const COMMIT_SHA = /^[0-9a-f]{40}$/u;
|
||||
const EMPTY_SELECTION = { runId: "", artifactName: "" };
|
||||
const positiveId = (value) =>
|
||||
(typeof value === "string" || typeof value === "number") &&
|
||||
@@ -76,6 +77,8 @@ function findTimingRun({
|
||||
positiveId(lineage?.head_repository_id) &&
|
||||
lineage.repository_id === lineage.head_repository_id &&
|
||||
lineage.repository_id === Number(repositoryId) &&
|
||||
typeof lineage.head_sha === "string" &&
|
||||
COMMIT_SHA.test(lineage.head_sha) &&
|
||||
lineage.head_branch === branch
|
||||
);
|
||||
})
|
||||
@@ -92,6 +95,7 @@ function findTimingRun({
|
||||
age >= 0 &&
|
||||
age < MAX_AGE_MS &&
|
||||
run.id === artifact.workflow_run.id &&
|
||||
run.head_sha === artifact.workflow_run.head_sha &&
|
||||
run.status === "completed" &&
|
||||
run.conclusion === "success" &&
|
||||
run.workflowPath?.file === ".github/workflows/ci.yml" &&
|
||||
|
||||
Reference in new issue
Block a user