spur-board 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/daemon.mjs +16 -4
- package/package.json +1 -1
package/dist/daemon.mjs
CHANGED
|
@@ -12107,9 +12107,16 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
|
|
|
12107
12107
|
role = label === "board-worker" ? "worker" : "other";
|
|
12108
12108
|
if (key !== void 0) break;
|
|
12109
12109
|
}
|
|
12110
|
+
let prOnlyKey;
|
|
12110
12111
|
if (key === void 0 && fact.pr !== null) {
|
|
12111
|
-
const linked = await trx.selectFrom("link").innerJoin("task", "task.id", "link.task_id").
|
|
12112
|
-
|
|
12112
|
+
const linked = await trx.selectFrom("link").innerJoin("task", "task.id", "link.task_id").leftJoin("pr_snapshot", (join) => join.on(sql`lower(pr_snapshot.repo) = lower(link.repo)`).onRef("pr_snapshot.number", "=", "link.number")).select([
|
|
12113
|
+
"task.key",
|
|
12114
|
+
"task.project",
|
|
12115
|
+
"pr_snapshot.head_branch"
|
|
12116
|
+
]).where("link.entity", "=", "pr").where(sql`lower(link.repo) = ${fact.pr.repo.toLowerCase()}`).where("link.number", "=", fact.pr.number).where("link.banned", "=", 0).executeTakeFirst();
|
|
12117
|
+
const project = config.projects.find((entry) => entry.id === linked?.project);
|
|
12118
|
+
if (linked !== void 0 && project?.spurProjects.some((spur) => spur.name === fact.spurProject && spur.role === "worker")) if (fact.branch !== null && linked.head_branch === fact.branch) key = linked.key;
|
|
12119
|
+
else prOnlyKey = linked.key;
|
|
12113
12120
|
}
|
|
12114
12121
|
if (key === void 0 && fact.branch !== null) {
|
|
12115
12122
|
const tasks = await trx.selectFrom("task").selectAll().where("membership", "!=", "archived").execute();
|
|
@@ -12123,6 +12130,11 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
|
|
|
12123
12130
|
if (!ambiguousBranches.has(fact.branch) || worker !== void 0) key = candidate?.key;
|
|
12124
12131
|
}
|
|
12125
12132
|
}
|
|
12133
|
+
const fromLabel = role !== void 0;
|
|
12134
|
+
if (key === void 0 && prOnlyKey !== void 0) {
|
|
12135
|
+
key = prOnlyKey;
|
|
12136
|
+
role = "other";
|
|
12137
|
+
}
|
|
12126
12138
|
if (key !== void 0 && projectForKey(config, key) !== null) {
|
|
12127
12139
|
const task = await trx.selectFrom("task").selectAll().where("key", "=", key).executeTakeFirst();
|
|
12128
12140
|
if (task !== void 0) {
|
|
@@ -12137,7 +12149,7 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
|
|
|
12137
12149
|
pr_state: null,
|
|
12138
12150
|
session_id: fact.id,
|
|
12139
12151
|
role: chosenRole,
|
|
12140
|
-
source:
|
|
12152
|
+
source: fromLabel ? "spawn_link" : "branch",
|
|
12141
12153
|
banned: 0,
|
|
12142
12154
|
created_at: at,
|
|
12143
12155
|
ticket_key: null,
|
|
@@ -12147,7 +12159,7 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
|
|
|
12147
12159
|
entity: "session",
|
|
12148
12160
|
session: fact.id,
|
|
12149
12161
|
role: chosenRole,
|
|
12150
|
-
source:
|
|
12162
|
+
source: fromLabel ? "spawn_link" : "branch",
|
|
12151
12163
|
facts: fact
|
|
12152
12164
|
});
|
|
12153
12165
|
}
|