apify-test-tools 0.10.2-beta.14 → 0.10.2-beta.16

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.
@@ -23,6 +23,7 @@ name: 'Platform tests: Claude failure investigation and fix'
23
23
  # uses: apify/apify-test-tools/.github/workflows/public_platform-tests.yaml@workflows-v0
24
24
  # with:
25
25
  # subtest: core
26
+ # report-slack-channel: '#notif-my-repo'
26
27
  # secrets:
27
28
  # TESTER_APIFY_TOKEN: ${{ secrets.TESTER_APIFY_TOKEN }}
28
29
  # SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
@@ -13,7 +13,7 @@ on:
13
13
  type: string
14
14
  default: ''
15
15
  required: false
16
- # Defaults to #notif-<repo-name> when empty.
16
+ # Slack channel for failed tests. Empty skips Slack.
17
17
  report-slack-channel:
18
18
  type: string
19
19
  default: ''
@@ -69,8 +69,8 @@ jobs:
69
69
  | apify-test-tools test ./test/platform/${{ inputs.test-files-glob || inputs.subtest }} \
70
70
  --reporter github-actions --vitest-output-file ./test-output.json > test-report.json
71
71
 
72
- # Posts only when the tests failed, but checks the Slack token on every run. Runs whenever the tests
73
- # did, also after a failure, but not when the token check stopped the job before them.
72
+ # Posts only when the tests failed, but checks the Slack token on every run that has a channel. Runs
73
+ # whenever the tests did, also after a failure, but not when the token check stopped the job before them.
74
74
  - name: Notify
75
75
  if: ${{ !cancelled() && steps.test.outcome != 'skipped' }}
76
76
  env:
@@ -78,6 +78,8 @@ jobs:
78
78
  # Passed through the environment, so a quote in the workflow name can't break the command
79
79
  WORKFLOW_NAME: ${{ github.workflow }}
80
80
  JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
81
+ # Empty makes notify skip Slack
82
+ SLACK_CHANNEL: ${{ inputs.report-slack-channel }}
81
83
  run: |
82
84
  # Empty when `test` itself failed before running vitest, its error is in the Test step
83
85
  if [ ! -s test-report.json ]; then
@@ -85,7 +87,7 @@ jobs:
85
87
  exit 0
86
88
  fi
87
89
  apify-test-tools notify \
88
- --slack-channel "${{ inputs.report-slack-channel || format('#notif-{0}', github.event.repository.name) }}" \
90
+ --slack-channel "$SLACK_CHANNEL" \
89
91
  --title "$WORKFLOW_NAME" \
90
92
  --job-url "$JOB_URL" \
91
93
  < test-report.json
@@ -3,7 +3,7 @@ name: Build latest and report to slack
3
3
  on:
4
4
  workflow_call:
5
5
  inputs:
6
- # Defaults to #notif-<repo-name> when empty.
6
+ # Slack channel for release announcements. Empty skips Slack.
7
7
  report-slack-channel:
8
8
  type: string
9
9
  default: ''
@@ -65,13 +65,14 @@ jobs:
65
65
  | node "${{ steps.setup.outputs.scripts-path }}/run-with-apify-tokens.mjs" \
66
66
  apify-test-tools build --version-number default
67
67
 
68
- # Skips the announcement when the push brought no new commits
68
+ # Skips the announcement when the push brought no new commits, or when no channel is set
69
69
  - name: Announce the release on Slack
70
70
  env:
71
71
  SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
72
+ SLACK_CHANNEL: ${{ inputs.report-slack-channel }}
72
73
  run: |
73
74
  apify-test-tools notify \
74
- --slack-channel "${{ inputs.report-slack-channel || format('#notif-{0}', github.event.repository.name) }}" \
75
+ --slack-channel "$SLACK_CHANNEL" \
75
76
  < affected.json
76
77
 
77
78
  - name: Delete old builds
@@ -0,0 +1,51 @@
1
+ name: Close stale issues
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ stale-months:
7
+ description: Months without activity before warning issue owners (one month = 30 days). Issues close 30 days after the warning.
8
+ type: number
9
+ default: 6
10
+
11
+ jobs:
12
+ staleIssues:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 30
15
+ permissions:
16
+ issues: write
17
+ concurrency:
18
+ group: stale-issues-${{ github.repository }}
19
+ cancel-in-progress: false
20
+ steps:
21
+ - name: Convert months to days
22
+ id: threshold
23
+ uses: actions/github-script@v9
24
+ env:
25
+ STALE_MONTHS: ${{ inputs.stale-months }}
26
+ with:
27
+ script: |
28
+ const months = Number(process.env.STALE_MONTHS);
29
+ if (!Number.isSafeInteger(months) || months < 1 || !Number.isSafeInteger(months * 30)) {
30
+ throw new Error('stale-months must be a positive whole number whose day count is a safe integer.');
31
+ }
32
+ if (months > 12) {
33
+ throw new Error('stale-months must be less than or equal to 12.');
34
+ }
35
+ return months * 30;
36
+
37
+ - name: Warn and close stale issues
38
+ uses: actions/stale@v11
39
+ with:
40
+ days-before-issue-stale: ${{ steps.threshold.outputs.result }}
41
+ days-before-issue-close: 30
42
+ days-before-pr-stale: ${{ steps.threshold.outputs.result }}
43
+ days-before-pr-close: 30
44
+ stale-issue-label: stale
45
+ stale-issue-message: >-
46
+ This issue has had no activity for ${{ inputs.stale-months }} month(s).
47
+ It will be closed as not planned in 30 days unless it is updated or commented on.
48
+ close-issue-message: Closed as not planned after 30 days without activity following the stale warning.
49
+ close-issue-reason: not_planned
50
+ remove-stale-when-updated: true
51
+ operations-per-run: 1000
package/CHANGELOG.md CHANGED
@@ -16,6 +16,8 @@ All notable changes to this project will be documented in this file.
16
16
  - Support flexible secret passing methods in workflows ([#225](https://github.com/apify/apify-test-tools/pull/225)) ([22f7e80](https://github.com/apify/apify-test-tools/commit/22f7e807ca3949656c15b79f848a192d71b15946)) by [@metalwarrior665](https://github.com/metalwarrior665), closes [#205](https://github.com/apify/apify-test-tools/issues/205)
17
17
  - [**breaking**] Require env vars of test versions in sync with the default version ([#217](https://github.com/apify/apify-test-tools/pull/217)) ([a2481dd](https://github.com/apify/apify-test-tools/commit/a2481ddf09004308cb54e49b783c8b21a25dcbe4)) by [@metalwarrior665](https://github.com/metalwarrior665)
18
18
  - Add impact &amp; priority assessment to claude investigator ([#216](https://github.com/apify/apify-test-tools/pull/216)) ([fd16622](https://github.com/apify/apify-test-tools/commit/fd16622b910ec6e9b5515ea0bd26b0a41c22bd23)) by [@foxt451](https://github.com/foxt451), closes [#208](https://github.com/apify/apify-test-tools/issues/208)
19
+ - Stale issue&#x2F;pr workflow ([#236](https://github.com/apify/apify-test-tools/pull/236)) ([aff1fa7](https://github.com/apify/apify-test-tools/commit/aff1fa778adb846a60fdacdd26aa13a71729613d)) by [@JuanGalilea](https://github.com/JuanGalilea), closes [#35](https://github.com/apify/apify-test-tools/issues/35)
20
+ - **workflows:** [**breaking**] Skip Slack when report-slack-channel is empty ([#238](https://github.com/apify/apify-test-tools/pull/238)) ([9a15b56](https://github.com/apify/apify-test-tools/commit/9a15b56de9ca42fb5ea753dc478116f9cd9c2c94)) by [@metalwarrior665](https://github.com/metalwarrior665)
19
21
 
20
22
  ### 🐛 Bug Fixes
21
23
 
package/CONTRIBUTING.md CHANGED
@@ -73,7 +73,7 @@ You need to run `npm run build` inside `apify-test-tools` repo everytime you wan
73
73
  ## Reusable workflows
74
74
 
75
75
  The `public_`-prefixed workflows are the ones consumer repos call: `public_pr-build-test`,
76
- `public_platform-tests`, `public_push-build-latest`, `public_claude`, `public_review` and
76
+ `public_platform-tests`, `public_push-build-latest`, `public_claude`, `public_review`, `public_stale-issues` and
77
77
  `public_platform-tests-claude-investigate-and-fix`. They live here because they call this package's
78
78
  CLI, so a change to both is one PR. GitHub only reads workflow files at the top level of
79
79
  `.github/workflows`, so they sit next to this repo's own CI, and the prefix is what separates the
package/README.md CHANGED
@@ -210,7 +210,7 @@ The workflows take every change straight to production, with tests in between:
210
210
  These are GitHub Actions workflows. On another CI platform, build the same flow with the [CLI](docs/cli.md).
211
211
 
212
212
  Add these files to `.github/workflows` in your repo. They call the reusable workflows in this repo, pinned at the
213
- `@workflows-v0` major tag — never at `@master`. Every input, the optional Claude workflows, and how the tag moves are
213
+ `@workflows-v0` major tag — never at `@master`. Every input, the optional Claude workflows, stale issue closer, and how the tag moves are
214
214
  in the [Workflow API](docs/workflows.md).
215
215
 
216
216
  ### `pr-build-devel-test.yaml`
package/docs/workflows.md CHANGED
@@ -26,6 +26,7 @@ The build, release and test workflows below list the CLI commands they run.
26
26
  | [`public_platform-tests.yaml`](#public_platform-testsyaml) | `schedule` | Runs platform tests against the released builds and reports results to Slack |
27
27
  | [`public_review.yaml`](#public_reviewyaml) | `pull_request` (labeled) | Claude reviews the PR against the shared guidelines |
28
28
  | [`public_claude.yaml`](#public_claudeyaml) | issue and PR comments, issue labels | Claude acts on `@claude` mentions |
29
+ | [`public_stale-issues.yaml`](#public_stale-issuesyaml) | `schedule` | Warns owners of inactive issues, then closes them a month later |
29
30
  | [`public_platform-tests-claude-investigate-and-fix.yaml`](#public_platform-tests-claude-investigate-and-fixyaml) | after a failed platform test job | Claude investigates a failing platform test, opens an issue, and tries to fix it |
30
31
 
31
32
  All of them run on `ubuntu-latest` with Node.js 24. The ones that need the repo's dependencies install them with
@@ -106,9 +107,9 @@ Releases the Actors a push changed. Skipped when the head commit message contain
106
107
  4. `delete-old-builds` deletes old builds of every Actor in the config (see
107
108
  [`delete-old-builds`](cli.md#deleting-old-builds-delete-old-builds)).
108
109
 
109
- | Input | Type | Default | Description |
110
- | ---------------------- | ------ | ------- | ------------------------------------------------------------- |
111
- | `report-slack-channel` | string | `''` | Slack channel for the report. Empty uses `#notif-<repo-name>` |
110
+ | Input | Type | Default | Description |
111
+ | ---------------------- | ------ | ------- | ----------------------------------------------- |
112
+ | `report-slack-channel` | string | `''` | Slack channel for the report. Empty skips Slack |
112
113
 
113
114
  Secrets: `SLACK_BOT_TOKEN`, the Actor tokens in `CONFIG_SECRETS`, and optionally `NPM_TOKEN`.
114
115
 
@@ -125,6 +126,8 @@ on:
125
126
  jobs:
126
127
  buildLatest:
127
128
  uses: apify/apify-test-tools/.github/workflows/public_push-build-latest.yaml@workflows-v0
129
+ with:
130
+ report-slack-channel: '#notif-my-repo'
128
131
  secrets:
129
132
  SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
130
133
  # One entry per secret apify-test-tools.config.json names, today each `tokenEnvVar`
@@ -147,7 +150,7 @@ vitest's own JSON report are uploaded as the `vitest-results` artifact. Runs onl
147
150
  | ---------------------- | ------ | ------- | ---------------------------------------------------------------------------- |
148
151
  | `test-files-glob` | string | `''` | Which tests to run, relative to `test/platform`. Empty runs everything in it |
149
152
  | `subtest` | string | `''` | Deprecated, use `test-files-glob` |
150
- | `report-slack-channel` | string | `''` | Slack channel for the results. Empty uses `#notif-<repo-name>` |
153
+ | `report-slack-channel` | string | `''` | Slack channel for the results. Empty skips Slack |
151
154
 
152
155
  Secrets: `TESTER_APIFY_TOKEN` (required), `SLACK_BOT_TOKEN`, and optionally `NPM_TOKEN`.
153
156
 
@@ -165,6 +168,8 @@ on:
165
168
  jobs:
166
169
  platformTestsDaily:
167
170
  uses: apify/apify-test-tools/.github/workflows/public_platform-tests.yaml@workflows-v0
171
+ with:
172
+ report-slack-channel: '#notif-my-repo'
168
173
  secrets:
169
174
  TESTER_APIFY_TOKEN: ${{ secrets.TESTER_APIFY_TOKEN }}
170
175
  SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
@@ -186,6 +191,7 @@ jobs:
186
191
  uses: apify/apify-test-tools/.github/workflows/public_platform-tests.yaml@workflows-v0
187
192
  with:
188
193
  test-files-glob: hourly
194
+ report-slack-channel: '#notif-my-repo'
189
195
  secrets:
190
196
  TESTER_APIFY_TOKEN: ${{ secrets.TESTER_APIFY_TOKEN }}
191
197
  SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
@@ -285,6 +291,7 @@ jobs:
285
291
  uses: apify/apify-test-tools/.github/workflows/public_platform-tests.yaml@workflows-v0
286
292
  with:
287
293
  test-files-glob: hourly
294
+ report-slack-channel: '#notif-my-repo'
288
295
  secrets:
289
296
  TESTER_APIFY_TOKEN: ${{ secrets.TESTER_APIFY_TOKEN }}
290
297
  SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
@@ -298,6 +305,44 @@ jobs:
298
305
  TESTER_APIFY_TOKEN: ${{ secrets.TESTER_APIFY_TOKEN }}
299
306
  ```
300
307
 
308
+ ## `public_stale-issues.yaml`
309
+
310
+ Optional. Wraps [`actions/stale`](https://github.com/actions/stale) to warn on inactive GitHub issues, then close them
311
+ as **not planned** 30 days later if still inactive. Locked issues are skipped. Pull requests use the same stale and
312
+ close thresholds, with the `Stale` label and no warning or closing comments.
313
+
314
+ | Input | Type | Default | Description |
315
+ | -------------- | ------ | ------- | -------------------------------------------------------------------- |
316
+ | `stale-months` | number | `6` | Optional whole number of inactive months (1–12); one month = 30 days |
317
+
318
+ ```yaml
319
+ name: Close stale issues
320
+
321
+ on:
322
+ schedule:
323
+ - cron: '0 3 * * *'
324
+ workflow_dispatch:
325
+
326
+ jobs:
327
+ staleIssues:
328
+ permissions:
329
+ issues: write
330
+ uses: apify/apify-test-tools/.github/workflows/public_stale-issues.yaml@workflows-v0
331
+ with:
332
+ stale-months: 6
333
+ ```
334
+
335
+ With `stale-months: 6`, an issue is labeled `stale` and warned after 180 days without activity, then closed after
336
+ another 30 inactive days. Existing older issues also get the full 30-day warning when adopting the workflow.
337
+ Actions happen on a scheduled run after the threshold; large backlogs are processed over successive runs.
338
+
339
+ The warning comment uses [GitHub's normal issue notifications](https://docs.github.com/en/subscriptions-and-notifications/reference/inbox-filters),
340
+ including notifications for assigned issues, subject to each user's notification settings. It does not add explicit
341
+ @mentions. Subsequent activity causes `actions/stale` to remove the stale label and restart the inactivity period.
342
+
343
+ The caller must grant `issues: write` as shown above. The workflow uses the automatic `GITHUB_TOKEN`; no additional
344
+ secrets, checkout, project dependencies, or Apify configuration are needed.
345
+
301
346
  ## Secrets
302
347
 
303
348
  The workflows take two kinds of secrets:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify-test-tools",
3
- "version": "0.10.2-beta.14",
3
+ "version": "0.10.2-beta.16",
4
4
  "type": "module",
5
5
  "description": "TBD",
6
6
  "repository": {