apify-test-tools 0.10.2-beta.10 → 0.10.2-beta.11
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/.github/actionlint.yaml +11 -0
- package/.github/actions/checkout-restore-dependencies/action.yaml +2 -3
- package/.github/workflows/_check_code.yaml +0 -16
- package/.github/workflows/_move_major_tag.yaml +2 -2
- package/.github/workflows/public_platform-tests-claude-investigate-and-fix.yaml +3 -1
- package/.github/workflows/public_platform-tests.yaml +3 -2
- package/.github/workflows/public_pr-build-test.yaml +6 -4
- package/.github/workflows/public_push-build-latest.yaml +3 -2
- package/.github/workflows/public_review.yaml +5 -4
- package/CHANGELOG.md +1 -0
- package/CONTRIBUTING.md +14 -10
- package/docs/workflows.md +6 -3
- package/package.json +1 -1
- package/.github/scripts/check-major-tag-refs.mjs +0 -72
package/.github/actionlint.yaml
CHANGED
|
@@ -10,3 +10,14 @@ paths:
|
|
|
10
10
|
ignore:
|
|
11
11
|
- 'input "display_report" is not defined in action "anthropics/claude-code-action@v1"'
|
|
12
12
|
- 'property "conclusion" is not defined in object type'
|
|
13
|
+
|
|
14
|
+
# actionlint (v1.7.11, and v1.7.12 too) predates two newer GitHub features these workflows rely on:
|
|
15
|
+
# - `uses: $/path`, the self-repository syntax: this repo at the commit the workflow runs at.
|
|
16
|
+
# actionlint only knows `./path`, `docker://` and `owner/repo@ref`, so it reports the ref as missing.
|
|
17
|
+
# https://github.blog/changelog/2026-07-30-reference-same-repository-actions-with-self-repository-syntax/
|
|
18
|
+
# - `job.workflow_repository` and `job.workflow_sha`, the reusable workflow's own repo and commit.
|
|
19
|
+
# https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#job-context
|
|
20
|
+
.github/workflows/public_*.yaml:
|
|
21
|
+
ignore:
|
|
22
|
+
- 'specifying action "\$/[^"]*" in invalid format because ref is missing'
|
|
23
|
+
- 'property "workflow_(repository|sha)" is not defined in object type'
|
|
@@ -23,9 +23,8 @@ outputs:
|
|
|
23
23
|
value: ${{ steps.scripts-path.outputs.path }}
|
|
24
24
|
|
|
25
25
|
# Sets common steps and ensure we use cached node_modules
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# push to master.
|
|
26
|
+
# The reusable workflows load this with `uses: $/...`, which resolves to the same commit as the
|
|
27
|
+
# workflow itself, so testing a change here only needs the caller pointed at your branch.
|
|
29
28
|
runs:
|
|
30
29
|
using: 'composite'
|
|
31
30
|
steps:
|
|
@@ -26,22 +26,6 @@ jobs:
|
|
|
26
26
|
# - name: Check spelling with typos
|
|
27
27
|
# uses: crate-ci/typos@v1
|
|
28
28
|
|
|
29
|
-
major_tag_refs:
|
|
30
|
-
name: Major tag refs
|
|
31
|
-
runs-on: ubuntu-latest
|
|
32
|
-
steps:
|
|
33
|
-
- name: Checkout repository
|
|
34
|
-
uses: actions/checkout@v6
|
|
35
|
-
- name: Use Node.js
|
|
36
|
-
uses: actions/setup-node@v6
|
|
37
|
-
with:
|
|
38
|
-
node-version: 24
|
|
39
|
-
# `uses:` takes no expressions, so the major tag is repeated in every ref into this repo.
|
|
40
|
-
# Missing one during a bump is silent while both tags exist: the new workflows quietly
|
|
41
|
-
# run the old composite action.
|
|
42
|
-
- name: Check refs match MAJOR_TAG
|
|
43
|
-
run: node .github/scripts/check-major-tag-refs.mjs
|
|
44
|
-
|
|
45
29
|
lint_check:
|
|
46
30
|
name: Lint check
|
|
47
31
|
runs-on: ubuntu-latest
|
|
@@ -42,8 +42,8 @@ jobs:
|
|
|
42
42
|
# it. Depending on a regex in another repo to keep releases working is not a dependency
|
|
43
43
|
# worth having, and `v1` beside a package `v1.0.0` would be worse still.
|
|
44
44
|
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
45
|
+
# The workflows load this repo with `$/`, so they never name the tag. Only the usage
|
|
46
|
+
# examples in the workflows, README and docs do: update them by hand when bumping it.
|
|
47
47
|
MAJOR_TAG: workflows-v0
|
|
48
48
|
steps:
|
|
49
49
|
- name: Checkout repository
|
|
@@ -187,7 +187,9 @@ jobs:
|
|
|
187
187
|
actions: read
|
|
188
188
|
steps:
|
|
189
189
|
- name: Setup repository and dependencies
|
|
190
|
-
|
|
190
|
+
# `$/` loads the action from this repo at the commit this workflow was called at, so a caller
|
|
191
|
+
# pinned to a SHA or a branch gets that commit's action and CLI, not whatever the major tag is on.
|
|
192
|
+
uses: $/.github/actions/checkout-restore-dependencies
|
|
191
193
|
with:
|
|
192
194
|
npm-token: ${{ secrets.NPM_TOKEN }}
|
|
193
195
|
|
|
@@ -37,8 +37,9 @@ jobs:
|
|
|
37
37
|
runs-on: ubuntu-latest
|
|
38
38
|
steps:
|
|
39
39
|
- name: Setup repository and dependencies
|
|
40
|
-
#
|
|
41
|
-
|
|
40
|
+
# `$/` loads the action from this repo at the commit this workflow was called at, so a caller
|
|
41
|
+
# pinned to a SHA or a branch gets that commit's action and CLI, not whatever the major tag is on.
|
|
42
|
+
uses: $/.github/actions/checkout-restore-dependencies
|
|
42
43
|
with:
|
|
43
44
|
npm-token: ${{ secrets.NPM_TOKEN }}
|
|
44
45
|
|
|
@@ -45,8 +45,9 @@ jobs:
|
|
|
45
45
|
steps:
|
|
46
46
|
- name: Setup repository and dependencies
|
|
47
47
|
id: setup
|
|
48
|
-
#
|
|
49
|
-
|
|
48
|
+
# `$/` loads the action from this repo at the commit this workflow was called at, so a caller
|
|
49
|
+
# pinned to a SHA or a branch gets that commit's action and CLI, not whatever the major tag is on.
|
|
50
|
+
uses: $/.github/actions/checkout-restore-dependencies
|
|
50
51
|
with:
|
|
51
52
|
# Some repos use private npm packages, they need to pass NPM_TOKEN secret to this workflow
|
|
52
53
|
npm-token: ${{ secrets.NPM_TOKEN }}
|
|
@@ -134,8 +135,9 @@ jobs:
|
|
|
134
135
|
runs-on: ubuntu-latest
|
|
135
136
|
steps:
|
|
136
137
|
- name: Setup repository and dependencies
|
|
137
|
-
#
|
|
138
|
-
|
|
138
|
+
# `$/` loads the action from this repo at the commit this workflow was called at, so a caller
|
|
139
|
+
# pinned to a SHA or a branch gets that commit's action and CLI, not whatever the major tag is on.
|
|
140
|
+
uses: $/.github/actions/checkout-restore-dependencies
|
|
139
141
|
with:
|
|
140
142
|
npm-token: ${{ secrets.NPM_TOKEN }}
|
|
141
143
|
|
|
@@ -36,8 +36,9 @@ jobs:
|
|
|
36
36
|
steps:
|
|
37
37
|
- name: Setup repository and dependencies
|
|
38
38
|
id: setup
|
|
39
|
-
#
|
|
40
|
-
|
|
39
|
+
# `$/` loads the action from this repo at the commit this workflow was called at, so a caller
|
|
40
|
+
# pinned to a SHA or a branch gets that commit's action and CLI, not whatever the major tag is on.
|
|
41
|
+
uses: $/.github/actions/checkout-restore-dependencies
|
|
41
42
|
with:
|
|
42
43
|
npm-token: ${{ secrets.NPM_TOKEN }}
|
|
43
44
|
config-secrets: ${{ secrets.CONFIG_SECRETS }}
|
|
@@ -14,12 +14,12 @@ on:
|
|
|
14
14
|
description: Label added after a successful review and never removed. Set to an empty string to disable.
|
|
15
15
|
required: false
|
|
16
16
|
prompt-ref:
|
|
17
|
-
default:
|
|
17
|
+
default: ''
|
|
18
18
|
type: string
|
|
19
19
|
description: >-
|
|
20
20
|
Ref of this repository to fetch the review instructions from. Defaults to the
|
|
21
|
-
|
|
22
|
-
test a prompt change from a branch.
|
|
21
|
+
commit this workflow was called at, so the instructions always match it. Override
|
|
22
|
+
it only to test a prompt change from a branch.
|
|
23
23
|
required: false
|
|
24
24
|
model:
|
|
25
25
|
default: sonnet
|
|
@@ -55,10 +55,11 @@ jobs:
|
|
|
55
55
|
# head_ref must be used for pull_request but for push and schedule events we have to use ref to get the branch name
|
|
56
56
|
ref: ${{ github.head_ref || github.ref }}
|
|
57
57
|
|
|
58
|
+
# job.workflow_* is this reusable workflow's own repo and commit; the github context is the caller's.
|
|
58
59
|
- name: 'Fetch review instructions'
|
|
59
60
|
run: |
|
|
60
61
|
curl -sfL \
|
|
61
|
-
"https://raw.githubusercontent.com
|
|
62
|
+
"https://raw.githubusercontent.com/${{ job.workflow_repository }}/${{ inputs.prompt-ref || job.workflow_sha }}/.github/review-prompt.md" \
|
|
62
63
|
-o "${{ github.workspace }}/.claude-review-prompt.md"
|
|
63
64
|
|
|
64
65
|
- name: 'Review PR against guidelines'
|
package/CHANGELOG.md
CHANGED
|
@@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
|
|
|
21
21
|
- **toBeObject:** Reject null ([#191](https://github.com/apify/apify-test-tools/pull/191)) ([6bdae49](https://github.com/apify/apify-test-tools/commit/6bdae4905756e0ae8dd6146942e6fc04dbead48e)) by [@JuanGalilea](https://github.com/JuanGalilea), closes [#88](https://github.com/apify/apify-test-tools/issues/88)
|
|
22
22
|
- Build and test on test-only changes even when .dockerignore lists the tests ([#177](https://github.com/apify/apify-test-tools/pull/177)) ([5cb1b5a](https://github.com/apify/apify-test-tools/commit/5cb1b5ab5f6f43ec279f9624b402e73d55a5974a)) by [@artogahr](https://github.com/artogahr), closes [#145](https://github.com/apify/apify-test-tools/issues/145)
|
|
23
23
|
- **git:** List both paths of moved files when detecting changes ([#215](https://github.com/apify/apify-test-tools/pull/215)) ([44ba565](https://github.com/apify/apify-test-tools/commit/44ba565242c1ac3daea281a648acb28712bb4363)) by [@metalwarrior665](https://github.com/metalwarrior665)
|
|
24
|
+
- **workflows:** Load setup action and review prompt from the called commit ([#226](https://github.com/apify/apify-test-tools/pull/226)) ([7524711](https://github.com/apify/apify-test-tools/commit/752471135d4d147f6f6492a26c08af388d7ccf72)) by [@metalwarrior665](https://github.com/metalwarrior665)
|
|
24
25
|
|
|
25
26
|
### 🚜 Refactor
|
|
26
27
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -99,10 +99,16 @@ Consumers pin `@workflows-v0`, not `@master`. See [Versioning and releases](#ver
|
|
|
99
99
|
`npm run lint` and `actionlint` (via the `Code checks` workflow) both gate master, so run them before
|
|
100
100
|
pushing workflow changes.
|
|
101
101
|
|
|
102
|
+
The reusable workflows load the composite action with `uses: $/.github/actions/checkout-restore-dependencies`, never
|
|
103
|
+
`apify/apify-test-tools/...@workflows-v0`. `$/` is the
|
|
104
|
+
[self-repository syntax](https://github.blog/changelog/2026-07-30-reference-same-repository-actions-with-self-repository-syntax/):
|
|
105
|
+
it resolves to this repo at the commit the workflow was called at. A hardcoded tag would hand a caller pinned to an
|
|
106
|
+
older SHA, or to a branch, the action and CLI from the tag instead of from the commit they asked for.
|
|
107
|
+
|
|
102
108
|
`public_review` is the odd one out: it fetches `.github/review-prompt.md` over HTTP at run time, because a
|
|
103
|
-
reusable workflow runs with the caller's repo checked out and never gets its own.
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
reusable workflow runs with the caller's repo checked out and never gets its own. With `prompt-ref` left empty it
|
|
110
|
+
fetches from `job.workflow_repository` at `job.workflow_sha`, the commit the workflow itself came from, so the
|
|
111
|
+
instructions always match the workflow.
|
|
106
112
|
|
|
107
113
|
## Versioning and releases
|
|
108
114
|
|
|
@@ -135,17 +141,15 @@ freezes where it is and keeps working, CLI included, since the bundle is part of
|
|
|
135
141
|
|
|
136
142
|
The tag tracks the **workflows'** contract, not the npm package version. They move independently on purpose, so
|
|
137
143
|
`@workflows-v0` is expected to stay `@workflows-v0` after the package reaches 1.0 — bump it when a workflow breaks
|
|
138
|
-
its callers, not when the package does.
|
|
139
|
-
|
|
140
|
-
mistake that would otherwise ship silently during a bump.
|
|
144
|
+
its callers, not when the package does. The usage examples in the workflows, README and docs repeat the tag
|
|
145
|
+
literally, so update them by hand when you bump it.
|
|
141
146
|
|
|
142
147
|
## Testing workflow changes
|
|
143
148
|
|
|
144
149
|
- Point [testing-repo-for-github-actions](https://github.com/apify-store/testing-repo-for-github-actions) at your
|
|
145
|
-
branch (`uses: ...@your-branch`). It has real attached Actors and tests. The
|
|
146
|
-
one branch tests the workflows and the CLI
|
|
147
|
-
|
|
148
|
-
well, and change them back before merging.
|
|
150
|
+
branch (`uses: ...@your-branch`). It has real attached Actors and tests. The workflows load the composite action
|
|
151
|
+
with `$/` and the branch carries its own CLI bundle, so one branch tests the workflows, the action and the CLI
|
|
152
|
+
together, with nothing to repoint.
|
|
149
153
|
- Make sure the shell code actually works on your laptop first.
|
|
150
154
|
- After merging, watch the workflow on a real project before moving on.
|
|
151
155
|
|
package/docs/workflows.md
CHANGED
|
@@ -199,7 +199,7 @@ that label is on. The trigger label is removed once the review finishes, so re-a
|
|
|
199
199
|
| ---------------- | ------ | ------------------- | --------------------------------------------------------------------------------------------- |
|
|
200
200
|
| `label` | string | `Ask claude review` | Label that triggers a review |
|
|
201
201
|
| `reviewed-label` | string | `claude reviewed` | Label added after a successful review and never removed. Set to `''` to disable |
|
|
202
|
-
| `prompt-ref` | string | `
|
|
202
|
+
| `prompt-ref` | string | `''` | Ref of this repo to fetch the review instructions from. Override only to test a prompt change |
|
|
203
203
|
| `model` | string | `sonnet` | Claude Code model (`best`, `sonnet`, `opus`, `haiku`, `sonnet[1m]`, `opus[1m]`, `opusplan`) |
|
|
204
204
|
|
|
205
205
|
Secrets: `ANTHROPIC_API_KEY`.
|
|
@@ -219,8 +219,8 @@ jobs:
|
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
The review instructions live in `.github/review-prompt.md` in this repo and are fetched at run time, because a
|
|
222
|
-
reusable workflow doesn't get its own repo checked out. `prompt-ref`
|
|
223
|
-
|
|
222
|
+
reusable workflow doesn't get its own repo checked out. When `prompt-ref` is empty they come from the same commit as
|
|
223
|
+
the workflow you're calling — point it at a branch only to test a prompt change.
|
|
224
224
|
|
|
225
225
|
## `public_claude.yaml`
|
|
226
226
|
|
|
@@ -362,6 +362,9 @@ The workflows and the vitest library ship separately:
|
|
|
362
362
|
The workflows bring their own copy of the CLI, so they don't use or change the `apify-test-tools` version in your
|
|
363
363
|
`node_modules`, and your tests keep the library version you locked.
|
|
364
364
|
|
|
365
|
+
Whatever ref you call a workflow at, it runs the setup action and the CLI from that same commit. Pinning a commit SHA
|
|
366
|
+
or pointing at a branch of this repo therefore gets you that commit's workflows as a whole.
|
|
367
|
+
|
|
365
368
|
`@workflows-v0` always points at the latest workflows, so fixes and new features reach you without any change on your
|
|
366
369
|
side. Changes that would break callers go to a new tag (`@workflows-v1`), and `@workflows-v0` keeps working, so you
|
|
367
370
|
can migrate when it suits you.
|
package/package.json
CHANGED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Fails if any reference to this repo's own reusable workflows or composite actions points at a
|
|
3
|
-
// different tag than MAJOR_TAG in _move_major_tag.yaml.
|
|
4
|
-
//
|
|
5
|
-
// `uses:` cannot take an expression ("You cannot use contexts or expressions in this keyword"), so
|
|
6
|
-
// the tag consumers pin is repeated literally in every self-reference, in the commented examples,
|
|
7
|
-
// and in the README snippets people copy. Bumping the major means editing all of them by hand.
|
|
8
|
-
//
|
|
9
|
-
// Missing one is quiet in the worst case: right after a bump both the old and new tags exist, so a
|
|
10
|
-
// workflow called at the new tag happily pulls the composite action from the old one and runs a
|
|
11
|
-
// stale version of it. Nothing fails, the behaviour is just wrong.
|
|
12
|
-
|
|
13
|
-
import fs from 'node:fs';
|
|
14
|
-
import path from 'node:path';
|
|
15
|
-
|
|
16
|
-
const ROOT = path.resolve(import.meta.dirname, '../..');
|
|
17
|
-
const TAG_SOURCE = '.github/workflows/_move_major_tag.yaml';
|
|
18
|
-
const REVIEW_WORKFLOW = '.github/workflows/public_review.yaml';
|
|
19
|
-
|
|
20
|
-
// Every place a ref into this repo can appear: live `uses:`, commented examples, README snippets.
|
|
21
|
-
const SEARCH_PATHS = ['.github', 'README.md', 'CONTRIBUTING.md', 'docs'];
|
|
22
|
-
|
|
23
|
-
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), 'utf8');
|
|
24
|
-
|
|
25
|
-
const expected = read(TAG_SOURCE).match(/^\s*MAJOR_TAG:\s*(\S+)\s*$/m)?.[1];
|
|
26
|
-
if (!expected) {
|
|
27
|
-
console.error(`Could not find MAJOR_TAG in ${TAG_SOURCE}.`);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const walk = (rel) => {
|
|
32
|
-
const abs = path.join(ROOT, rel);
|
|
33
|
-
if (!fs.statSync(abs).isDirectory()) return [rel];
|
|
34
|
-
return fs.readdirSync(abs).flatMap((entry) => walk(path.join(rel, entry)));
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const problems = [];
|
|
38
|
-
|
|
39
|
-
// Self-references, e.g. `uses: apify/apify-test-tools/.github/workflows/public_pr-build-test.yaml@workflows-v0`.
|
|
40
|
-
// The ref charset stops at a backtick or quote so a ref quoted in prose isn't captured with its
|
|
41
|
-
// punctuation; git refnames cannot end in a dot, so a sentence-final one is trimmed.
|
|
42
|
-
const SELF_REF = /apify\/apify-test-tools\/\.github\/\S*?@([A-Za-z0-9._/-]+)/g;
|
|
43
|
-
for (const file of SEARCH_PATHS.flatMap(walk)) {
|
|
44
|
-
read(file)
|
|
45
|
-
.split('\n')
|
|
46
|
-
.forEach((line, i) => {
|
|
47
|
-
for (const [match, rawRef] of line.matchAll(SELF_REF)) {
|
|
48
|
-
const ref = rawRef.replace(/\.+$/, '');
|
|
49
|
-
if (ref !== expected) {
|
|
50
|
-
problems.push(`${file}:${i + 1}: ${match.trim()} — expected @${expected}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// review.yaml fetches its prompt from this repo by ref rather than by `uses:`, so it drifts the
|
|
57
|
-
// same way: released workflows would read instructions from some other commit.
|
|
58
|
-
const promptRef = read(REVIEW_WORKFLOW).match(/prompt-ref:\s*\n\s*default:\s*(\S+)/)?.[1];
|
|
59
|
-
if (!promptRef) {
|
|
60
|
-
problems.push(`${REVIEW_WORKFLOW}: could not read the prompt-ref default.`);
|
|
61
|
-
} else if (promptRef !== expected) {
|
|
62
|
-
problems.push(`${REVIEW_WORKFLOW}: prompt-ref default is ${promptRef} — expected ${expected}`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (problems.length > 0) {
|
|
66
|
-
console.error(`MAJOR_TAG is ${expected}, but these disagree:\n`);
|
|
67
|
-
for (const problem of problems) console.error(` ${problem}`);
|
|
68
|
-
console.error(`\nUpdate them, or change MAJOR_TAG in ${TAG_SOURCE}.`);
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
console.log(`All references to this repo point at @${expected}.`);
|