@7n/rules-ci-github 1.6.0 → 1.6.1
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.6.1] - 2026-07-18
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- fix-service_deploy_workflow: `parseNRulesCmd`/`relevantDomains` перенесено в спільний `@7n/rules/scripts/lib/lint-surface/ci-plan.mjs` (jscpd-дублікат із ci-azure), без зміни поведінки
|
|
8
|
+
|
|
3
9
|
## [1.6.0] - 2026-07-18
|
|
4
10
|
|
|
5
11
|
### Added
|
package/package.json
CHANGED
|
@@ -3,9 +3,8 @@ type: JS Module
|
|
|
3
3
|
title: fix-service_deploy_workflow.mjs
|
|
4
4
|
resource: plugins/ci-github/rules/ga/service_deploy_workflow/fix-service_deploy_workflow.mjs
|
|
5
5
|
docgen:
|
|
6
|
-
crc:
|
|
6
|
+
crc: c6a64f66
|
|
7
7
|
model: openai-codex/gpt-5.4-mini
|
|
8
|
-
tier: cloud-min
|
|
9
8
|
score: 100
|
|
10
9
|
issues: judge:inaccurate:0.99
|
|
11
10
|
judgeModel: openai-codex/gpt-5.4-mini
|
|
@@ -22,16 +22,13 @@
|
|
|
22
22
|
* коментарі та форматування незачеплених частин зберігаються. Наявний
|
|
23
23
|
* нетривіальний `if` не перезаписується (deny лишається — ручне рішення).
|
|
24
24
|
*/
|
|
25
|
-
import { readFileSync, writeFileSync, existsSync
|
|
26
|
-
import { join
|
|
25
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs'
|
|
26
|
+
import { join } from 'node:path'
|
|
27
27
|
|
|
28
28
|
import { parseDocument } from 'yaml'
|
|
29
29
|
|
|
30
|
-
import {
|
|
31
|
-
import { collectPathScopedFiles } from '@7n/rules/scripts/lib/lint-surface/path-scope.mjs'
|
|
32
|
-
import { domainKey } from '@7n/rules/scripts/lib/lint-surface/ci-plan.mjs'
|
|
30
|
+
import { domainKey, parseNRulesCmd, relevantDomains } from '@7n/rules/scripts/lib/lint-surface/ci-plan.mjs'
|
|
33
31
|
|
|
34
|
-
const WS_RE = /\s+/u
|
|
35
32
|
const GLOB_SUFFIX_RE = /\/\*+$/u
|
|
36
33
|
|
|
37
34
|
const CANONICAL_DEPLOY_IF = `\${{ !cancelled() && needs.plan.result == 'success' && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}`
|
|
@@ -42,33 +39,6 @@ const CANONICAL_PREP = [
|
|
|
42
39
|
{ uses: './.github/actions/setup-bun-deps' }
|
|
43
40
|
]
|
|
44
41
|
|
|
45
|
-
/**
|
|
46
|
-
* Розбирає команду `n-rules …` токенами (стійко до багаторядкових run-ів).
|
|
47
|
-
* @param {string} cmd текст run-кроку
|
|
48
|
-
* @param {string} marker підрядок-початок (`n-rules lint` | `n-rules ci plan`)
|
|
49
|
-
* @returns {{ domain: string|null, path: string|null }|null} розбір або null
|
|
50
|
-
*/
|
|
51
|
-
function parseNRulesCmd(cmd, marker) {
|
|
52
|
-
const at = cmd.indexOf(marker)
|
|
53
|
-
if (at === -1) return null
|
|
54
|
-
const tokens = cmd
|
|
55
|
-
.slice(at + marker.length)
|
|
56
|
-
.split(WS_RE)
|
|
57
|
-
.filter(Boolean)
|
|
58
|
-
let domain = null
|
|
59
|
-
let path = null
|
|
60
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
61
|
-
const t = tokens[i]
|
|
62
|
-
if (t === '--path') {
|
|
63
|
-
path = tokens[i + 1] ?? null
|
|
64
|
-
i++
|
|
65
|
-
continue
|
|
66
|
-
}
|
|
67
|
-
if (!t.startsWith('-') && domain === null && path === null) domain = t
|
|
68
|
-
}
|
|
69
|
-
return { domain, path }
|
|
70
|
-
}
|
|
71
|
-
|
|
72
42
|
/**
|
|
73
43
|
* Текст run-кроку ('' якщо крок не run).
|
|
74
44
|
* @param {unknown} step крок джоби (plain JS)
|
|
@@ -106,26 +76,6 @@ function findLintStep(steps) {
|
|
|
106
76
|
return null
|
|
107
77
|
}
|
|
108
78
|
|
|
109
|
-
/**
|
|
110
|
-
* Релевантні домени сервісу (ті самі glob-и, що `ci plan` по не-дельті).
|
|
111
|
-
* @param {string} cwd корінь consumer-репо
|
|
112
|
-
* @param {string} servicePath каталог сервісу
|
|
113
|
-
* @returns {Promise<string[]>} відсортовані rule-id
|
|
114
|
-
*/
|
|
115
|
-
async function relevantDomains(cwd, servicePath) {
|
|
116
|
-
const abs = resolve(cwd, servicePath)
|
|
117
|
-
if (!existsSync(abs) || !statSync(abs).isDirectory()) return []
|
|
118
|
-
const files = await collectPathScopedFiles(cwd, servicePath)
|
|
119
|
-
const { byRule, enabledSet } = await loadEnabledLintRules({ cwd })
|
|
120
|
-
const active = computeActiveDomains(byRule, enabledSet, files)
|
|
121
|
-
return active
|
|
122
|
-
.entries()
|
|
123
|
-
.filter(([, st]) => st.triggered)
|
|
124
|
-
.map(([id]) => id)
|
|
125
|
-
.toArray()
|
|
126
|
-
.toSorted((a, b) => a.localeCompare(b))
|
|
127
|
-
}
|
|
128
|
-
|
|
129
79
|
/**
|
|
130
80
|
* Prep-кроки для нових джоб: зразок із наявної джоби з `setup-bun-deps`
|
|
131
81
|
* (кроки до нього включно, checkout → fetch-depth: 0), інакше — канонічні.
|