@wtfalch/foundry 0.51.2 → 0.51.3
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.
|
@@ -112,9 +112,25 @@ export async function githubReleaseHookPlanInputs(deps, hostname, recorded) {
|
|
|
112
112
|
console.error(`github release hook: could not read Archon's env from Coolify (${error instanceof Error ? error.name : 'error'})`);
|
|
113
113
|
return { blocked: GITHUB_RELEASE_HOOK_COOLIFY_READ_FAILED };
|
|
114
114
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
if (!secret)
|
|
116
|
+
return { ready: true };
|
|
117
|
+
// A recorded hook someone deleted on GitHub: no hash, so the step plans again and makes it.
|
|
118
|
+
const recordedId = recorded[PLATFORM_GITHUB_RELEASE_HOOK_ID_SCOPE_KEY];
|
|
119
|
+
if (recordedId && !(await recordedHookLive(token, deps.fetchImpl, recordedId))) {
|
|
120
|
+
return { ready: true };
|
|
121
|
+
}
|
|
122
|
+
return { ready: true, hash: githubReleaseHookHash(githubReleaseHookUrl(hostname), secret) };
|
|
123
|
+
}
|
|
124
|
+
/** Whether GitHub still has the recorded hook. A failed read counts as gone: the step adopts by url, so running it again is safe. */
|
|
125
|
+
async function recordedHookLive(token, fetchImpl, id) {
|
|
126
|
+
try {
|
|
127
|
+
const client = createGithubHooksClient({ token, ...(fetchImpl ? { fetchImpl } : {}) });
|
|
128
|
+
return (await client.list(GITHUB_RELEASE_HOOK_ORG)).some((h) => String(h.id) === id);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
console.error(`github release hook: could not list the organisation's hooks (${error instanceof Error ? error.name : 'error'})`);
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
118
134
|
}
|
|
119
135
|
/**
|
|
120
136
|
* Makes the organisation's release webhook. Adopts the hook whose url is Archon's, else creates one;
|