Skip to content

Commit 2c8e068

Browse files
committed
feat: add workspace existence check at HEAD for new workspaces.
Assisted-by: Cursor Signed-off-by: David Festal <dfestal@redhat.com>
1 parent 7a6c107 commit 2c8e068

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

update-overlay/create-pr-if-necessary.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ module.exports = async ({github, context, core}) => {
167167
)
168168
return;
169169
}
170+
171+
// For new workspaces, verify the source folder still exists at HEAD of the source repo
172+
// This catches renamed/removed workspaces where NPM metadata points to old commit
173+
// Uses raw.githubusercontent.com to avoid spending GitHub API rate limits
174+
if (pluginsRepoFlat !== 'true') {
175+
const headCheckUrl = `https://raw.githubusercontent.com/${pluginsRepoOwner}/${pluginsRepoName}/HEAD/workspaces/${workspaceName}/package.json`;
176+
const headCheckResponse = await fetch(headCheckUrl, { method: 'HEAD' });
177+
if (!headCheckResponse.ok) {
178+
core.warning(
179+
`Workspace ${workspaceName} exists at commit ${workspaceCommit.substring(0,7)} but not at HEAD of ${pluginsRepoOwner}/${pluginsRepoName}. ` +
180+
`It was likely renamed or removed. Skipping.`,
181+
);
182+
return;
183+
}
184+
}
170185
}
171186

172187
/** @type { string | undefined } */

0 commit comments

Comments
 (0)