apify-test-tools 0.9.0-beta.1 → 0.9.0

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/bin/actor-filtering.ts +21 -0
  3. package/bin/git.ts +5 -1
  4. package/bin/main.ts +65 -61
  5. package/bin/slack.ts +4 -4
  6. package/bin/types.ts +2 -0
  7. package/bin/utils.ts +3 -2
  8. package/dist/bin/actor-filtering.d.ts +13 -0
  9. package/dist/bin/actor-filtering.d.ts.map +1 -0
  10. package/dist/bin/actor-filtering.js +19 -0
  11. package/dist/bin/actor-filtering.js.map +1 -0
  12. package/dist/bin/git.d.ts +1 -1
  13. package/dist/bin/git.d.ts.map +1 -1
  14. package/dist/bin/git.js +1 -1
  15. package/dist/bin/git.js.map +1 -1
  16. package/dist/bin/main.d.ts +20 -1
  17. package/dist/bin/main.d.ts.map +1 -1
  18. package/dist/bin/main.js +56 -37
  19. package/dist/bin/main.js.map +1 -1
  20. package/dist/bin/slack.js +4 -4
  21. package/dist/bin/slack.js.map +1 -1
  22. package/dist/bin/types.d.ts +2 -0
  23. package/dist/bin/types.d.ts.map +1 -1
  24. package/dist/bin/utils.d.ts +4 -1
  25. package/dist/bin/utils.d.ts.map +1 -1
  26. package/dist/bin/utils.js +3 -2
  27. package/dist/bin/utils.js.map +1 -1
  28. package/dist/lib/consts.d.ts +6 -0
  29. package/dist/lib/consts.d.ts.map +1 -1
  30. package/dist/lib/consts.js +6 -0
  31. package/dist/lib/consts.js.map +1 -1
  32. package/dist/lib/lib.js +3 -3
  33. package/dist/lib/lib.js.map +1 -1
  34. package/dist/test/unit/bin/actor-filtering.test.d.ts +2 -0
  35. package/dist/test/unit/bin/actor-filtering.test.d.ts.map +1 -0
  36. package/dist/test/unit/bin/actor-filtering.test.js +41 -0
  37. package/dist/test/unit/bin/actor-filtering.test.js.map +1 -0
  38. package/dist/test/unit/bin/utils.test.js +52 -24
  39. package/dist/test/unit/bin/utils.test.js.map +1 -1
  40. package/dist/tsconfig.tsbuildinfo +1 -1
  41. package/lib/consts.ts +7 -0
  42. package/lib/lib.ts +3 -3
  43. package/package.json +62 -62
  44. package/test/unit/bin/actor-filtering.test.ts +52 -0
  45. package/test/unit/bin/utils.test.ts +62 -24
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.9.0](https://github.com/apify/apify-test-tools/releases/tag/v0.9.0) (2026-08-11)
6
+
7
+ ### 🚀 Features
8
+
9
+ - [**breaking**] Replace folder naming convention for actor discovery with explicit config file ([#96](https://github.com/apify/apify-test-tools/pull/96)) ([bcf1187](https://github.com/apify/apify-test-tools/commit/bcf1187d98f74183a09b3edd91f7361097cba3e9)) by [@ruocco-l](https://github.com/ruocco-l), closes [#84](https://github.com/apify/apify-test-tools/issues/84)
10
+ - **only-and-omit:** Pick or exclude actors ([#113](https://github.com/apify/apify-test-tools/pull/113)) ([99506f6](https://github.com/apify/apify-test-tools/commit/99506f668073680eda6fb9d28e22881936b70d96)) by [@JuanGalilea](https://github.com/JuanGalilea)
11
+
12
+ ### 🐛 Bug Fixes
13
+
14
+ - Use slack mrkdwn in release notifications ([#107](https://github.com/apify/apify-test-tools/pull/107)) ([b5314e4](https://github.com/apify/apify-test-tools/commit/b5314e42dead43ebe7d501c448287fb6f026e9ed)) by [@JMatej](https://github.com/JMatej)
15
+ - Increase dataset sync timeout ([#109](https://github.com/apify/apify-test-tools/pull/109)) ([9e61cce](https://github.com/apify/apify-test-tools/commit/9e61cce3e2c96e6513c41b92e856c7ed85899d87)) by [@Patai5](https://github.com/Patai5), closes [#687](https://github.com/apify/apify-test-tools/issues/687)
16
+
17
+
5
18
  ## [0.8.6](https://github.com/apify/apify-test-tools/releases/tag/v0.8.6) (2026-07-16)
6
19
 
7
20
  ### 🐛 Bug Fixes
@@ -0,0 +1,21 @@
1
+ import type { ActorConfig } from './types.js';
2
+
3
+ /**
4
+ * Restricts a set of actors to those selected via `--actors` and not excluded via `--ignore`.
5
+ * Both filters match on `actorFullName` (`owner/name`). `--actors` is applied first (empty means
6
+ * "all"), then `--ignore` removes from the result. A name that doesn't exist in the config throws —
7
+ * a malformed selection must never silently build/release/delete the wrong set. The caller is
8
+ * responsible for turning that into a non-zero exit.
9
+ */
10
+ export function selectActors({ actors, ignore }: { actors: string[]; ignore: string[] }, actorConfigs: ActorConfig[]) {
11
+ const fullNames = actorConfigs.map((actor) => actor.actorFullName);
12
+ const missing = [...actors, ...ignore].filter((name) => !fullNames.includes(name));
13
+ if (missing.length > 0) {
14
+ throw new Error(`The following actors from the filter config do not exist: ${missing.join(', ')}`);
15
+ }
16
+
17
+ const afterOnly = actors.length
18
+ ? actorConfigs.filter((actor) => actors.includes(actor.actorFullName))
19
+ : actorConfigs;
20
+ return afterOnly.filter((actor) => !ignore.includes(actor.actorFullName));
21
+ }
package/bin/git.ts CHANGED
@@ -94,7 +94,11 @@ const fetchAllBranchCommits = (sourceBranch: string, targetBranch: string): Comm
94
94
  * Gets the commits between sourceBranch and targetBranch (exclusive).
95
95
  * - If baseCommit is provided, only returns commits after the baseCommit.
96
96
  */
97
- export const getCommits = ({ sourceBranch, targetBranch, baseCommit }: Config): Commit[] => {
97
+ export const getCommits = ({
98
+ sourceBranch,
99
+ targetBranch,
100
+ baseCommit,
101
+ }: Pick<Config, 'sourceBranch' | 'targetBranch' | 'baseCommit'>): Commit[] => {
98
102
  const baseCommitSha = parseBaseCommit(baseCommit);
99
103
  const commits = fetchAllBranchCommits(sourceBranch, targetBranch);
100
104
 
package/bin/main.ts CHANGED
@@ -21,7 +21,7 @@ import { readConfigFile, setCwd, spawnCommandInGhWorkspace } from './utils.js';
21
21
  */
22
22
  const middlewares = [setCwd];
23
23
 
24
- const buildOptions = (y: Argv) => {
24
+ export const buildOptions = <T>(y: Argv<T>) => {
25
25
  return y
26
26
  .option('target-branch', {
27
27
  type: 'string',
@@ -37,27 +37,44 @@ const buildOptions = (y: Argv) => {
37
37
  })
38
38
  .option('base-commit', {
39
39
  type: 'string',
40
+ demandOption: false,
40
41
  });
41
42
  };
42
43
 
43
- const resolveChangedActors = async (
44
- { targetBranch, sourceBranch, baseCommit }: Config,
45
- { isLatest }: { isLatest: boolean },
46
- ) => {
47
- const actorConfigs = await readConfigFile();
44
+ /**
45
+ * Actor-selection flags, applied to every command that reads the actor config so a caller can
46
+ * narrow the set it operates on (e.g. two-stage releases: `--ignore X`, then `--actors X`).
47
+ * Kept separate from `buildOptions` so the read-only git commands don't advertise flags they ignore.
48
+ */
49
+ export const actorSelectionOptions = <T>(y: Argv<T>) => {
50
+ return y
51
+ .option('actors', {
52
+ type: 'string',
53
+ array: true,
54
+ default: [] as string[],
55
+ })
56
+ .option('ignore', {
57
+ type: 'string',
58
+ array: true,
59
+ default: [] as string[],
60
+ });
61
+ };
62
+
63
+ const resolveChangedActors = async (config: Config, { isLatest }: { isLatest: boolean }) => {
64
+ const actorConfigs = await readConfigFile(config);
48
65
 
49
- // This is an optimization for the common case where a branch only has cosmetic changes but had to merge in
66
+ // This is an optimization for the common case where a branch only has cosmetic changes but had to smerge in
50
67
  // functional changes from master (being up-to-date is a CI requirement). Master is already validated, and
51
68
  // since the branch has no functional changes of its own, there is nothing new to validate.
52
69
  // Exception: if the branch has any functional changes alongside the merge, we must re-test — even
53
70
  // individually validated changes can have novel interactions when combined.
54
- if (hasMergeFromTarget(sourceBranch, targetBranch)) {
71
+ if (hasMergeFromTarget(config.sourceBranch, config.targetBranch)) {
55
72
  console.error(
56
73
  '[MERGE-FROM-TARGET-OPTIMIZATION]: There is merge from target branch, checking if there are no functional changes in our own branch. If so, we can skip tests',
57
74
  );
58
- const branchOnlyFiles = getBranchOnlyChangedFiles(sourceBranch, targetBranch);
75
+ const branchOnlyFiles = getBranchOnlyChangedFiles(config.sourceBranch, config.targetBranch);
59
76
  // Omit baseCommit to get full branch history. Validated functional commits can still interact with merged ones
60
- const allBranchCommits = getCommits({ sourceBranch, targetBranch, baseCommit: undefined });
77
+ const allBranchCommits = getCommits({ ...config, baseCommit: undefined });
61
78
  const branchOnlyActorsChanged = getChangedActors({
62
79
  filepathsChanged: branchOnlyFiles,
63
80
  actorConfigs,
@@ -73,7 +90,7 @@ const resolveChangedActors = async (
73
90
  }
74
91
 
75
92
  // If the optimization doesn't apply, we check all branch commits including merges for full coverage. We don't reuse the merge optimization results because here we can apply baseCommit and check merge commits (they might be functional or just cosmetic)
76
- const commits = getCommits({ targetBranch, sourceBranch, baseCommit });
93
+ const commits = getCommits(config);
77
94
  const changedFiles = getChangedFiles(commits);
78
95
  return getChangedActors({ filepathsChanged: changedFiles, actorConfigs, isLatest, commits });
79
96
  };
@@ -103,22 +120,19 @@ await yargs()
103
120
  const changedFiles = getChangedFiles(commits);
104
121
  console.log(JSON.stringify(changedFiles));
105
122
  })
123
+ .command('get-actor-configs', '', actorSelectionOptions, async ({ actors, ignore }) => {
124
+ const actorConfigs = await readConfigFile({ actors, ignore });
125
+ console.log(JSON.stringify(actorConfigs));
126
+ })
106
127
  .command(
107
- 'get-actor-configs',
128
+ 'get-affected-actors',
108
129
  '',
109
- (_) => _,
110
- async () => {
111
- const actorConfigs = await readConfigFile();
112
- console.log(JSON.stringify(actorConfigs));
130
+ (args) => actorSelectionOptions(buildOptions(args)),
131
+ async (config) => {
132
+ const actorsChanged = await resolveChangedActors(config, { isLatest: false });
133
+ console.log(JSON.stringify(actorsChanged));
113
134
  },
114
135
  )
115
- .command('get-affected-actors', '', buildOptions, async ({ targetBranch, sourceBranch, baseCommit }) => {
116
- const actorsChanged = await resolveChangedActors(
117
- { targetBranch, sourceBranch, baseCommit },
118
- { isLatest: false },
119
- );
120
- console.log(JSON.stringify(actorsChanged));
121
- })
122
136
  .command(
123
137
  'report-tests',
124
138
  '',
@@ -135,12 +149,9 @@ await yargs()
135
149
  .command(
136
150
  'build',
137
151
  '',
138
- (args) => buildOptions(args).option('dry-run', { type: 'boolean', default: false }),
139
- async ({ targetBranch, sourceBranch, baseCommit, dryRun, useDockerCache }) => {
140
- const actorsChanged = await resolveChangedActors(
141
- { targetBranch, sourceBranch, baseCommit },
142
- { isLatest: false },
143
- );
152
+ (args) => actorSelectionOptions(buildOptions(args)).option('dry-run', { type: 'boolean', default: false }),
153
+ async (config) => {
154
+ const actorsChanged = await resolveChangedActors(config, { isLatest: false });
144
155
  // https://github.com/apify-store/google-maps#:actors/lukaskrivka_google-maps-with-contact-details
145
156
  // git@github.com:apify-store/google-maps#:actors/lukaskrivka_google-maps-with-contact-details
146
157
  const repoUrl = spawnCommandInGhWorkspace(`git remote get-url origin`).replace(
@@ -151,9 +162,9 @@ await yargs()
151
162
  const builds = await runBuilds({
152
163
  repoUrl,
153
164
  actorConfigs: actorsChanged,
154
- branch: sourceBranch.replace('origin/', ''),
155
- dryRun,
156
- useDockerCache,
165
+ branch: config.sourceBranch.replace('origin/', ''),
166
+ dryRun: config.dryRun,
167
+ useDockerCache: config.useDockerCache,
157
168
  });
158
169
  console.log(JSON.stringify(builds));
159
170
  },
@@ -162,7 +173,7 @@ await yargs()
162
173
  'release',
163
174
  '',
164
175
  (args) =>
165
- args
176
+ actorSelectionOptions(args)
166
177
  .option('push-event-path', { type: 'string', demandOption: true })
167
178
  .option('dry-run', { type: 'boolean', default: false })
168
179
  .option('report-slack-channel', { type: 'string' })
@@ -173,7 +184,7 @@ await yargs()
173
184
  args.pushEventPath,
174
185
  );
175
186
  const isLatest = true;
176
- const actorConfigs = await readConfigFile();
187
+ const actorConfigs = await readConfigFile(args);
177
188
  const actorsChanged = getChangedActors({
178
189
  filepathsChanged: changedFiles,
179
190
  actorConfigs,
@@ -206,37 +217,30 @@ await yargs()
206
217
  .command(
207
218
  'build-from-local',
208
219
  '',
209
- (args) =>
210
- args
211
- .option('actors', {
212
- type: 'string',
213
- description:
214
- 'Comma-separated actor names (owner/name) to build. Defaults to all actors in the repo.',
215
- })
216
- .option('dry-run', { type: 'boolean', default: false }),
217
- async ({ actors, dryRun }) => {
218
- const allActorConfigs = await readConfigFile();
219
- const actorConfigs = actors
220
- ? actors.split(',').map((name) => {
221
- const trimmed = name.trim();
222
- const config = allActorConfigs.find((c) => c.actorFullName === trimmed);
223
- if (!config) throw new Error(`Actor "${trimmed}" not found in repo`);
224
- return config;
225
- })
226
- : allActorConfigs;
220
+ (args) => actorSelectionOptions(args).option('dry-run', { type: 'boolean', default: false }),
221
+ async ({ actors, ignore, dryRun }) => {
222
+ const actorConfigs = await readConfigFile({ actors, ignore });
227
223
  const builds = await runBuildsFromLocal({ actorConfigs, dryRun });
228
224
  console.log(JSON.stringify(builds));
229
225
  },
230
226
  )
231
- .command(
232
- 'delete-old-builds',
233
- '',
234
- (_) => _,
235
- async () => {
236
- const actorConfigs = await readConfigFile();
237
- await deleteOldBuilds(actorConfigs);
238
- },
239
- )
227
+ .command('delete-old-builds', '', actorSelectionOptions, async ({ actors, ignore }) => {
228
+ const actorConfigs = await readConfigFile({ actors, ignore });
229
+ await deleteOldBuilds(actorConfigs);
230
+ })
240
231
  .strictCommands()
241
232
  .demandCommand(1, 'Command is required')
233
+ .fail((msg, err, yargsInstance) => {
234
+ // Errors thrown from a command handler (e.g. an unknown actor passed to --actors/--ignore,
235
+ // or a missing config file) arrive here as `err`. A malformed selection must fail loudly
236
+ // rather than silently operate on the wrong set of actors — print the message, no stack.
237
+ if (err) {
238
+ console.error(`[ERROR]: ${err.message}`);
239
+ } else {
240
+ // Argument-parsing/validation failure — keep yargs' usage output.
241
+ console.error(yargsInstance.help());
242
+ console.error(`\n${msg}`);
243
+ }
244
+ process.exit(1);
245
+ })
242
246
  .parse(hideBin(process.argv));
package/bin/slack.ts CHANGED
@@ -30,11 +30,11 @@ export const notifyToSlack = async ({
30
30
  console.warn('No new changelog entries found, did you forget to update it?');
31
31
  }
32
32
 
33
- let shortMessage = `${repository} --- New release (by ${author}):\n\n`;
33
+ let shortMessage = `*${repository}* New release (by ${author}):\n\n`;
34
34
 
35
35
  // This one is just for broader public that only cares about public facing changes
36
36
  if (changelog && releaseSlackChannel) {
37
- shortMessage += `**Additions to the changelog**:\n\n${changelog}\n`;
37
+ shortMessage += `*Additions to the changelog*:\n\n${changelog}\n`;
38
38
  console.error(`=========================================`);
39
39
  console.error(`**Sending slack message to channel**: ${releaseSlackChannel}.\n\n${shortMessage}`);
40
40
  console.error(`=========================================`);
@@ -52,8 +52,8 @@ export const notifyToSlack = async ({
52
52
  `${index + 1}. Commit message: ${message}\n\tAuthor: ${commitAuthor}.`,
53
53
  )
54
54
  .join('\n')}`;
55
- const changedFilesMessage = `**Files changed**: ${changedFiles.join(', ')}`;
56
- const longMessage = `${shortMessage}\n**Commit list**:\n${commitsMessage}\n\n${changedFilesMessage}`;
55
+ const changedFilesMessage = `*Files changed*: ${changedFiles.map((file) => `\`${file}\``).join(', ')}`;
56
+ const longMessage = `${shortMessage}\n*Commit list*:\n${commitsMessage}\n\n${changedFilesMessage}`;
57
57
 
58
58
  // This one is for devs and project managers that need to know more details
59
59
  if (reportSlackChannel) {
package/bin/types.ts CHANGED
@@ -3,6 +3,8 @@ export interface Config {
3
3
  sourceBranch: string;
4
4
  baseCommit?: string;
5
5
  workspace?: string;
6
+ actors: string[];
7
+ ignore: string[];
6
8
  }
7
9
 
8
10
  export type Commit = {
package/bin/utils.ts CHANGED
@@ -6,6 +6,7 @@ import type { ActorVersionSourceFile } from 'apify-client';
6
6
 
7
7
  import { SOURCE_FILE_FORMATS } from '@apify/consts';
8
8
 
9
+ import { selectActors } from './actor-filtering.js';
9
10
  import { isPathWithinScope } from './path-utils.js';
10
11
  import type { ActorConfig, ActorConfigFile } from './types.js';
11
12
 
@@ -113,7 +114,7 @@ const findOverlappingContextPaths = (contextPaths: string[]): [string, string] |
113
114
  return undefined;
114
115
  };
115
116
 
116
- export const readConfigFile = async (): Promise<ActorConfig[]> => {
117
+ export const readConfigFile = async (selection: { actors: string[]; ignore: string[] }): Promise<ActorConfig[]> => {
117
118
  let raw: string;
118
119
  try {
119
120
  raw = await fs.readFile(CONFIG_FILE_NAME, 'utf-8');
@@ -225,7 +226,7 @@ export const readConfigFile = async (): Promise<ActorConfig[]> => {
225
226
  });
226
227
  }
227
228
 
228
- return actorConfigs;
229
+ return selectActors(selection, actorConfigs);
229
230
  };
230
231
 
231
232
  export const setCwd = ({ workspace }: { workspace: string | undefined }) => {
@@ -0,0 +1,13 @@
1
+ import type { ActorConfig } from './types.js';
2
+ /**
3
+ * Restricts a set of actors to those selected via `--actors` and not excluded via `--ignore`.
4
+ * Both filters match on `actorFullName` (`owner/name`). `--actors` is applied first (empty means
5
+ * "all"), then `--ignore` removes from the result. A name that doesn't exist in the config throws —
6
+ * a malformed selection must never silently build/release/delete the wrong set. The caller is
7
+ * responsible for turning that into a non-zero exit.
8
+ */
9
+ export declare function selectActors({ actors, ignore }: {
10
+ actors: string[];
11
+ ignore: string[];
12
+ }, actorConfigs: ActorConfig[]): ActorConfig[];
13
+ //# sourceMappingURL=actor-filtering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor-filtering.d.ts","sourceRoot":"","sources":["../../bin/actor-filtering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,YAAY,EAAE,WAAW,EAAE,iBAWnH"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Restricts a set of actors to those selected via `--actors` and not excluded via `--ignore`.
3
+ * Both filters match on `actorFullName` (`owner/name`). `--actors` is applied first (empty means
4
+ * "all"), then `--ignore` removes from the result. A name that doesn't exist in the config throws —
5
+ * a malformed selection must never silently build/release/delete the wrong set. The caller is
6
+ * responsible for turning that into a non-zero exit.
7
+ */
8
+ export function selectActors({ actors, ignore }, actorConfigs) {
9
+ const fullNames = actorConfigs.map((actor) => actor.actorFullName);
10
+ const missing = [...actors, ...ignore].filter((name) => !fullNames.includes(name));
11
+ if (missing.length > 0) {
12
+ throw new Error(`The following actors from the filter config do not exist: ${missing.join(', ')}`);
13
+ }
14
+ const afterOnly = actors.length
15
+ ? actorConfigs.filter((actor) => actors.includes(actor.actorFullName))
16
+ : actorConfigs;
17
+ return afterOnly.filter((actor) => !ignore.includes(actor.actorFullName));
18
+ }
19
+ //# sourceMappingURL=actor-filtering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor-filtering.js","sourceRoot":"","sources":["../../bin/actor-filtering.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,EAA0C,EAAE,YAA2B;IAChH,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACnF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,6DAA6D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvG,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM;QAC3B,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACtE,CAAC,CAAC,YAAY,CAAC;IACnB,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAC9E,CAAC"}
package/dist/bin/git.d.ts CHANGED
@@ -25,6 +25,6 @@ export declare const parseBaseCommit: (shaOrCommit: string | undefined) => strin
25
25
  * Gets the commits between sourceBranch and targetBranch (exclusive).
26
26
  * - If baseCommit is provided, only returns commits after the baseCommit.
27
27
  */
28
- export declare const getCommits: ({ sourceBranch, targetBranch, baseCommit }: Config) => Commit[];
28
+ export declare const getCommits: ({ sourceBranch, targetBranch, baseCommit, }: Pick<Config, "sourceBranch" | "targetBranch" | "baseCommit">) => Commit[];
29
29
  export declare const parseCommit: (commitString: string) => Commit;
30
30
  //# sourceMappingURL=git.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../bin/git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGjD,eAAO,MAAM,oBAAoB,uBAAQ,CAAC;AAG1C;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,EAAE,aAchD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,cAAc,MAAM,EAAE,cAAc,MAAM,KAAG,OAiB/E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,MAAM,EAAE,cAAc,MAAM,KAAG,MAAM,EAK5F,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAc1E,CAAC;AAWF;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,4CAA4C,MAAM,KAAG,MAAM,EAgCrF,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,cAAc,MAAM,KAAG,MAYlD,CAAC"}
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../bin/git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGjD,eAAO,MAAM,oBAAoB,uBAAQ,CAAC;AAG1C;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,EAAE,aAchD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,cAAc,MAAM,EAAE,cAAc,MAAM,KAAG,OAiB/E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,MAAM,EAAE,cAAc,MAAM,KAAG,MAAM,EAK5F,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAc1E,CAAC;AAWF;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,6CAIxB,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,GAAG,YAAY,CAAC,KAAG,MAAM,EAgCvE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,cAAc,MAAM,KAAG,MAYlD,CAAC"}
package/dist/bin/git.js CHANGED
@@ -76,7 +76,7 @@ const fetchAllBranchCommits = (sourceBranch, targetBranch) => {
76
76
  * Gets the commits between sourceBranch and targetBranch (exclusive).
77
77
  * - If baseCommit is provided, only returns commits after the baseCommit.
78
78
  */
79
- export const getCommits = ({ sourceBranch, targetBranch, baseCommit }) => {
79
+ export const getCommits = ({ sourceBranch, targetBranch, baseCommit, }) => {
80
80
  const baseCommitSha = parseBaseCommit(baseCommit);
81
81
  const commits = fetchAllBranchCommits(sourceBranch, targetBranch);
82
82
  // The last validated (base) commit being the branch HEAD means nothing new was pushed since the last
@@ -1 +1 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../bin/git.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAC1C,MAAM,cAAc,GAAG,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AAK,CAAC,2BAA2B,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/F,OAAO,qBAAqB,CAAC;IACjC,CAAC;IAED,OAAO,CAAC,KAAK,CACT,eAAe,aAAa,iDAAiD,OAAO,CAAC,MAAM,UAAU,CACxG,CAAC;IACF,OAAO,CAAC,KAAK,CAAC,2BAA2B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjF,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,YAAoB,EAAU,EAAE;IACxD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,kCAAkC,YAAY,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAC5C,OAAO;QACH,GAAG;QACH,MAAM;QACN,IAAI;QACJ,OAAO;KACV,CAAC;AACN,CAAC,CAAC"}
@@ -1,3 +1,22 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ import { type Argv } from 'yargs';
3
+ export declare const buildOptions: <T>(y: Argv<T>) => Argv<T & {
4
+ "target-branch": string;
5
+ } & {
6
+ "source-branch": string;
7
+ } & {
8
+ "use-docker-cache": boolean;
9
+ } & {
10
+ "base-commit": string | undefined;
11
+ }>;
12
+ /**
13
+ * Actor-selection flags, applied to every command that reads the actor config so a caller can
14
+ * narrow the set it operates on (e.g. two-stage releases: `--ignore X`, then `--actors X`).
15
+ * Kept separate from `buildOptions` so the read-only git commands don't advertise flags they ignore.
16
+ */
17
+ export declare const actorSelectionOptions: <T>(y: Argv<T>) => Argv<T & {
18
+ actors: string[];
19
+ } & {
20
+ ignore: string[];
21
+ }>;
3
22
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../bin/main.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../bin/main.ts"],"names":[],"mappings":";AAIA,OAAc,EAAE,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAmBzC,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;;;;;;;;EAkBzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;;;;EAYlD,CAAC"}
package/dist/bin/main.js CHANGED
@@ -15,7 +15,7 @@ import { readConfigFile, setCwd, spawnCommandInGhWorkspace } from './utils.js';
15
15
  * Middlewares to be run before every command execution
16
16
  */
17
17
  const middlewares = [setCwd];
18
- const buildOptions = (y) => {
18
+ export const buildOptions = (y) => {
19
19
  return y
20
20
  .option('target-branch', {
21
21
  type: 'string',
@@ -31,20 +31,39 @@ const buildOptions = (y) => {
31
31
  })
32
32
  .option('base-commit', {
33
33
  type: 'string',
34
+ demandOption: false,
34
35
  });
35
36
  };
36
- const resolveChangedActors = async ({ targetBranch, sourceBranch, baseCommit }, { isLatest }) => {
37
- const actorConfigs = await readConfigFile();
38
- // This is an optimization for the common case where a branch only has cosmetic changes but had to merge in
37
+ /**
38
+ * Actor-selection flags, applied to every command that reads the actor config so a caller can
39
+ * narrow the set it operates on (e.g. two-stage releases: `--ignore X`, then `--actors X`).
40
+ * Kept separate from `buildOptions` so the read-only git commands don't advertise flags they ignore.
41
+ */
42
+ export const actorSelectionOptions = (y) => {
43
+ return y
44
+ .option('actors', {
45
+ type: 'string',
46
+ array: true,
47
+ default: [],
48
+ })
49
+ .option('ignore', {
50
+ type: 'string',
51
+ array: true,
52
+ default: [],
53
+ });
54
+ };
55
+ const resolveChangedActors = async (config, { isLatest }) => {
56
+ const actorConfigs = await readConfigFile(config);
57
+ // This is an optimization for the common case where a branch only has cosmetic changes but had to smerge in
39
58
  // functional changes from master (being up-to-date is a CI requirement). Master is already validated, and
40
59
  // since the branch has no functional changes of its own, there is nothing new to validate.
41
60
  // Exception: if the branch has any functional changes alongside the merge, we must re-test — even
42
61
  // individually validated changes can have novel interactions when combined.
43
- if (hasMergeFromTarget(sourceBranch, targetBranch)) {
62
+ if (hasMergeFromTarget(config.sourceBranch, config.targetBranch)) {
44
63
  console.error('[MERGE-FROM-TARGET-OPTIMIZATION]: There is merge from target branch, checking if there are no functional changes in our own branch. If so, we can skip tests');
45
- const branchOnlyFiles = getBranchOnlyChangedFiles(sourceBranch, targetBranch);
64
+ const branchOnlyFiles = getBranchOnlyChangedFiles(config.sourceBranch, config.targetBranch);
46
65
  // Omit baseCommit to get full branch history. Validated functional commits can still interact with merged ones
47
- const allBranchCommits = getCommits({ sourceBranch, targetBranch, baseCommit: undefined });
66
+ const allBranchCommits = getCommits({ ...config, baseCommit: undefined });
48
67
  const branchOnlyActorsChanged = getChangedActors({
49
68
  filepathsChanged: branchOnlyFiles,
50
69
  actorConfigs,
@@ -57,7 +76,7 @@ const resolveChangedActors = async ({ targetBranch, sourceBranch, baseCommit },
57
76
  console.error(`[MERGE-FROM-TARGET-OPTIMIZATION]: Branch has ${branchOnlyActorsChanged.length} functional changes, cannot optimize, we continue with full check`);
58
77
  }
59
78
  // If the optimization doesn't apply, we check all branch commits including merges for full coverage. We don't reuse the merge optimization results because here we can apply baseCommit and check merge commits (they might be functional or just cosmetic)
60
- const commits = getCommits({ targetBranch, sourceBranch, baseCommit });
79
+ const commits = getCommits(config);
61
80
  const changedFiles = getChangedFiles(commits);
62
81
  return getChangedActors({ filepathsChanged: changedFiles, actorConfigs, isLatest, commits });
63
82
  };
@@ -86,12 +105,12 @@ await yargs()
86
105
  const changedFiles = getChangedFiles(commits);
87
106
  console.log(JSON.stringify(changedFiles));
88
107
  })
89
- .command('get-actor-configs', '', (_) => _, async () => {
90
- const actorConfigs = await readConfigFile();
108
+ .command('get-actor-configs', '', actorSelectionOptions, async ({ actors, ignore }) => {
109
+ const actorConfigs = await readConfigFile({ actors, ignore });
91
110
  console.log(JSON.stringify(actorConfigs));
92
111
  })
93
- .command('get-affected-actors', '', buildOptions, async ({ targetBranch, sourceBranch, baseCommit }) => {
94
- const actorsChanged = await resolveChangedActors({ targetBranch, sourceBranch, baseCommit }, { isLatest: false });
112
+ .command('get-affected-actors', '', (args) => actorSelectionOptions(buildOptions(args)), async (config) => {
113
+ const actorsChanged = await resolveChangedActors(config, { isLatest: false });
95
114
  console.log(JSON.stringify(actorsChanged));
96
115
  })
97
116
  .command('report-tests', '', (args) => args
@@ -101,21 +120,21 @@ await yargs()
101
120
  .option('workflow-name', { type: 'string' }), async (args) => {
102
121
  await reportTestResults(args);
103
122
  })
104
- .command('build', '', (args) => buildOptions(args).option('dry-run', { type: 'boolean', default: false }), async ({ targetBranch, sourceBranch, baseCommit, dryRun, useDockerCache }) => {
105
- const actorsChanged = await resolveChangedActors({ targetBranch, sourceBranch, baseCommit }, { isLatest: false });
123
+ .command('build', '', (args) => actorSelectionOptions(buildOptions(args)).option('dry-run', { type: 'boolean', default: false }), async (config) => {
124
+ const actorsChanged = await resolveChangedActors(config, { isLatest: false });
106
125
  // https://github.com/apify-store/google-maps#:actors/lukaskrivka_google-maps-with-contact-details
107
126
  // git@github.com:apify-store/google-maps#:actors/lukaskrivka_google-maps-with-contact-details
108
127
  const repoUrl = spawnCommandInGhWorkspace(`git remote get-url origin`).replace(/^https:\/\/github\.com\//, 'git@github.com:');
109
128
  const builds = await runBuilds({
110
129
  repoUrl,
111
130
  actorConfigs: actorsChanged,
112
- branch: sourceBranch.replace('origin/', ''),
113
- dryRun,
114
- useDockerCache,
131
+ branch: config.sourceBranch.replace('origin/', ''),
132
+ dryRun: config.dryRun,
133
+ useDockerCache: config.useDockerCache,
115
134
  });
116
135
  console.log(JSON.stringify(builds));
117
136
  })
118
- .command('release', '', (args) => args
137
+ .command('release', '', (args) => actorSelectionOptions(args)
119
138
  .option('push-event-path', { type: 'string', demandOption: true })
120
139
  .option('dry-run', { type: 'boolean', default: false })
121
140
  .option('report-slack-channel', { type: 'string' })
@@ -123,7 +142,7 @@ await yargs()
123
142
  .option('use-docker-cache', { type: 'boolean', default: false }), async (args) => {
124
143
  const { branch, changedFiles, repoUrl, commits, changelog, repository, author } = await getPushData(args.pushEventPath);
125
144
  const isLatest = true;
126
- const actorConfigs = await readConfigFile();
145
+ const actorConfigs = await readConfigFile(args);
127
146
  const actorsChanged = getChangedActors({
128
147
  filepathsChanged: changedFiles,
129
148
  actorConfigs,
@@ -151,30 +170,30 @@ await yargs()
151
170
  releaseSlackChannel,
152
171
  });
153
172
  })
154
- .command('build-from-local', '', (args) => args
155
- .option('actors', {
156
- type: 'string',
157
- description: 'Comma-separated actor names (owner/name) to build. Defaults to all actors in the repo.',
158
- })
159
- .option('dry-run', { type: 'boolean', default: false }), async ({ actors, dryRun }) => {
160
- const allActorConfigs = await readConfigFile();
161
- const actorConfigs = actors
162
- ? actors.split(',').map((name) => {
163
- const trimmed = name.trim();
164
- const config = allActorConfigs.find((c) => c.actorFullName === trimmed);
165
- if (!config)
166
- throw new Error(`Actor "${trimmed}" not found in repo`);
167
- return config;
168
- })
169
- : allActorConfigs;
173
+ .command('build-from-local', '', (args) => actorSelectionOptions(args).option('dry-run', { type: 'boolean', default: false }), async ({ actors, ignore, dryRun }) => {
174
+ const actorConfigs = await readConfigFile({ actors, ignore });
170
175
  const builds = await runBuildsFromLocal({ actorConfigs, dryRun });
171
176
  console.log(JSON.stringify(builds));
172
177
  })
173
- .command('delete-old-builds', '', (_) => _, async () => {
174
- const actorConfigs = await readConfigFile();
178
+ .command('delete-old-builds', '', actorSelectionOptions, async ({ actors, ignore }) => {
179
+ const actorConfigs = await readConfigFile({ actors, ignore });
175
180
  await deleteOldBuilds(actorConfigs);
176
181
  })
177
182
  .strictCommands()
178
183
  .demandCommand(1, 'Command is required')
184
+ .fail((msg, err, yargsInstance) => {
185
+ // Errors thrown from a command handler (e.g. an unknown actor passed to --actors/--ignore,
186
+ // or a missing config file) arrive here as `err`. A malformed selection must fail loudly
187
+ // rather than silently operate on the wrong set of actors — print the message, no stack.
188
+ if (err) {
189
+ console.error(`[ERROR]: ${err.message}`);
190
+ }
191
+ else {
192
+ // Argument-parsing/validation failure — keep yargs' usage output.
193
+ console.error(yargsInstance.help());
194
+ console.error(`\n${msg}`);
195
+ }
196
+ process.exit(1);
197
+ })
179
198
  .parse(hideBin(process.argv));
180
199
  //# sourceMappingURL=main.js.map