Skip to content

Commit 39ce2e2

Browse files
change: stop autobuilding Actors on circ_le account (#97)
## Summary This PR removes the functionality that automatically discovers and builds actors from the `circ_le` Apify account during the build process. ## Key Changes - Removed the `findCircleApifyManaged()` function that queried the `circ_le` account for actors matching naming patterns - Removed the conditional logic in `runBuilds()` that called `findCircleApifyManaged()` when `isLatest` was true - Removed the unused import of `getEnvVar` utility function - Simplified the build loop to only process actors from the provided `actorConfigs` parameter ## Implementation Details The removed `findCircleApifyManaged()` function previously: - Connected to the `circ_le` Apify account using a hardcoded token - Matched actors by name pattern (removing `apify-managed---` prefix) - Included a special case hack for the `google-search-scraper` actor - Logged detailed information about discovered and matched actors This change simplifies the build process by removing the special handling for externally-managed actors, making the build configuration more explicit and maintainable. https://claude.ai/code/session_018xNhRQfGxV6yoivYhVjvbK Co-authored-by: Claude <noreply@anthropic.com>
1 parent aff64c5 commit 39ce2e2

1 file changed

Lines changed: 1 addition & 56 deletions

File tree

bin/build.ts

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { ApifyClient } from 'apify-client';
44
import { ACTOR_SOURCE_TYPES } from '@apify/consts';
55

66
import type { ActorConfig, BuildData } from './types.js';
7-
import { getEnvVar } from './utils.js';
87

98
type BuildPrActorOptions = {
109
buildTag?: string;
@@ -243,9 +242,7 @@ export const runBuilds = async ({
243242
}: RunBuildsOptions) => {
244243
const buildConfigs: BuildPrActorOptions[] = [];
245244

246-
const circleActors = isLatest ? await findCircleApifyManaged(actorConfigs) : [];
247-
248-
for (const { actorName, folder } of actorConfigs.concat(circleActors)) {
245+
for (const { actorName, folder } of actorConfigs) {
249246
let versionNumber: string;
250247
let buildTag: string | undefined;
251248

@@ -301,55 +298,3 @@ export const deleteOldBuilds = async (actorConfigs: ActorConfig[]) => {
301298
await ApifyBuilder.fromActorName(actorName).deleteOldBuilds();
302299
}
303300
};
304-
305-
/**
306-
* We will read all Actors in the circ_le account and build those that match by name pattern
307-
* There are many ways to approach this, a more robust one would be to have a map of Actors
308-
* which would allow to have more than one special user per Actor
309-
* But since that use-case might never be needed, I went with the simplest solution that doesn't require maintaining the map
310-
* NOTE: One issue is that if any Actor is renamed, we will not match it in the circ_le account nor throw any error
311-
*/
312-
const findCircleApifyManaged = async (actorConfigs: ActorConfig[]): Promise<ActorConfig[]> => {
313-
// This token is hardcoded in the runner Actor, locally you have to inject it
314-
const client = new ApifyClient({ token: getEnvVar('APIFY_TOKEN_CIRC_LE') });
315-
316-
const { items: circleActors } = await client.actors().list();
317-
318-
const actorsToBuild = circleActors
319-
.map<ActorConfig | undefined>((circleActor) => {
320-
// They prefix all with apify-managed---, I communicated with Jacques to keep doing that
321-
let actorConfigFound = actorConfigs.find(
322-
(actorConfig) =>
323-
circleActor.name.replace('apify-managed---', '') === actorConfig.actorName.split('/')[1],
324-
);
325-
326-
// Hack for bad naming of circ_le/apify-managed-google-search, we don't want to rename now to break customers
327-
if (!actorConfigFound && circleActor.name === 'apify-managed-google-search') {
328-
actorConfigFound = actorConfigs.find(
329-
(actorConfig) => actorConfig.actorName.split('/')[1] === 'google-search-scraper',
330-
);
331-
}
332-
333-
if (actorConfigFound) {
334-
return {
335-
// We point the circle Actor to the repo folder
336-
actorName: `${circleActor.username}/${circleActor.name}`,
337-
folder: actorConfigFound.folder,
338-
isStandalone: actorConfigFound.isStandalone,
339-
};
340-
}
341-
return undefined;
342-
})
343-
.filter((config) => config !== undefined);
344-
345-
console.error(
346-
`Found ${actorsToBuild.length} circ_le actors that match Actors we built out of total ${circleActors.length} circ_le actors`,
347-
);
348-
console.error(`All circ_le actors: ${circleActors.map((actor) => actor.name).join(', ')}`);
349-
console.error(`circ_le Actors to build: ${actorsToBuild.map((actor) => actor.actorName).join(', ')}`);
350-
351-
if (actorsToBuild.length === 0) {
352-
console.error('No circ_le actors to build');
353-
}
354-
return actorsToBuild;
355-
};

0 commit comments

Comments
 (0)