pipecraft 0.29.2 → 0.36.2
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/README.md +98 -34
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +66 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/init.tpl.d.ts +4 -4
- package/dist/generators/init.tpl.d.ts.map +1 -1
- package/dist/generators/init.tpl.js +369 -79
- package/dist/generators/init.tpl.js.map +1 -1
- package/dist/generators/workflows.tpl.d.ts +9 -9
- package/dist/generators/workflows.tpl.d.ts.map +1 -1
- package/dist/generators/workflows.tpl.js +33 -24
- package/dist/generators/workflows.tpl.js.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts +7 -4
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.js +16 -9
- package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-pr.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.js +9 -6
- package/dist/templates/actions/create-pr.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-release.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-release.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-release.yml.tpl.js +9 -6
- package/dist/templates/actions/create-release.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.js +9 -6
- package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts +24 -52
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.js +281 -108
- package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.js +9 -6
- package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.js +27 -76
- package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
- package/dist/templates/actions/run-nx-affected.yml.tpl.d.ts +33 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.js +346 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.js.map +1 -0
- package/dist/templates/release-it.cjs.tpl.d.ts +1 -1
- package/dist/templates/release-it.cjs.tpl.d.ts.map +1 -1
- package/dist/templates/release-it.cjs.tpl.js +24 -26
- package/dist/templates/release-it.cjs.tpl.js.map +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.d.ts +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.js +2 -3
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts +2 -2
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js +300 -93
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts +2 -2
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.js +347 -74
- package/dist/templates/workflows/pipeline.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.d.ts +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.js +101 -22
- package/dist/templates/workflows/pr-title-check.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/shared/index.d.ts +3 -2
- package/dist/templates/workflows/shared/index.d.ts.map +1 -1
- package/dist/templates/workflows/shared/index.js +3 -2
- package/dist/templates/workflows/shared/index.js.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.d.ts +13 -2
- package/dist/templates/workflows/shared/operations-changes.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.js +47 -16
- package/dist/templates/workflows/shared/operations-changes.js.map +1 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts +18 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.js +143 -19
- package/dist/templates/workflows/shared/operations-domain-jobs.js.map +1 -1
- package/dist/templates/workflows/shared/operations-gate.d.ts +32 -0
- package/dist/templates/workflows/shared/operations-gate.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-gate.js +77 -0
- package/dist/templates/workflows/shared/operations-gate.js.map +1 -0
- package/dist/templates/workflows/shared/operations-header.d.ts +1 -1
- package/dist/templates/workflows/shared/operations-header.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-header.js +46 -6
- package/dist/templates/workflows/shared/operations-header.js.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts +5 -1
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.js +138 -31
- package/dist/templates/workflows/shared/operations-tag-promote.js.map +1 -1
- package/dist/templates/workflows/shared/operations-version.d.ts +3 -1
- package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-version.js +18 -10
- package/dist/templates/workflows/shared/operations-version.js.map +1 -1
- package/dist/templates/yaml-format-utils.d.ts.map +1 -1
- package/dist/templates/yaml-format-utils.js.map +1 -1
- package/dist/types/index.d.ts +57 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/action-reference.d.ts +73 -0
- package/dist/utils/action-reference.d.ts.map +1 -0
- package/dist/utils/action-reference.js +120 -0
- package/dist/utils/action-reference.js.map +1 -0
- package/dist/utils/ast-path-operations.d.ts +3 -3
- package/dist/utils/ast-path-operations.d.ts.map +1 -1
- package/dist/utils/ast-path-operations.js +58 -17
- package/dist/utils/ast-path-operations.js.map +1 -1
- package/dist/utils/config.d.ts +11 -5
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +33 -8
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/github-setup.d.ts +4 -4
- package/dist/utils/github-setup.d.ts.map +1 -1
- package/dist/utils/github-setup.js +57 -36
- package/dist/utils/github-setup.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/messaging.d.ts.map +1 -1
- package/dist/utils/messaging.js +7 -3
- package/dist/utils/messaging.js.map +1 -1
- package/dist/utils/preflight.d.ts +2 -2
- package/dist/utils/preflight.d.ts.map +1 -1
- package/dist/utils/preflight.js +43 -41
- package/dist/utils/preflight.js.map +1 -1
- package/dist/utils/versioning.d.ts +1 -1
- package/dist/utils/versioning.d.ts.map +1 -1
- package/dist/utils/versioning.js +10 -10
- package/dist/utils/versioning.js.map +1 -1
- package/package.json +11 -4
- package/src/generators/init.tpl.ts +434 -96
- package/src/generators/workflows.tpl.ts +54 -45
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts +0 -32
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts.map +0 -1
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js +0 -227
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js.map +0 -1
- package/dist/utils/idempotency.d.ts +0 -187
- package/dist/utils/idempotency.d.ts.map +0 -1
- package/dist/utils/idempotency.js +0 -304
- package/dist/utils/idempotency.js.map +0 -1
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module templates/actions/promote-branch.yml.tpl
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import fs from 'fs';
|
|
9
|
+
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
11
10
|
import dedent from 'dedent';
|
|
11
|
+
import fs from 'fs';
|
|
12
12
|
import { logger } from '../../utils/logger.js';
|
|
13
|
+
import { getActionOutputDir } from '../../utils/action-reference.js';
|
|
13
14
|
/**
|
|
14
15
|
* Generates the promote-branch composite action YAML content.
|
|
15
16
|
*
|
|
@@ -26,6 +27,9 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
26
27
|
description: 'Source branch to promote from (defaults to github.ref_name)'
|
|
27
28
|
required: false
|
|
28
29
|
default: \${{ github.ref_name }}
|
|
30
|
+
targetBranch:
|
|
31
|
+
description: 'Target branch to promote to'
|
|
32
|
+
required: true
|
|
29
33
|
version:
|
|
30
34
|
description: 'Version being promoted (e.g., v1.2.3, auto-detected from git tags if not provided)'
|
|
31
35
|
required: false
|
|
@@ -34,10 +38,10 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
34
38
|
description: 'The original run number from develop branch for traceability'
|
|
35
39
|
required: false
|
|
36
40
|
default: ''
|
|
37
|
-
|
|
38
|
-
description: '
|
|
41
|
+
autoMerge:
|
|
42
|
+
description: 'Whether to enable auto-merge for the PR'
|
|
39
43
|
required: false
|
|
40
|
-
default: '
|
|
44
|
+
default: 'false'
|
|
41
45
|
tempBranchPattern:
|
|
42
46
|
description: 'Pattern for temp branch name'
|
|
43
47
|
required: false
|
|
@@ -57,12 +61,6 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
57
61
|
tempBranch:
|
|
58
62
|
description: 'The temporary branch name'
|
|
59
63
|
value: \${{ steps.create-temp.outputs.tempBranch }}
|
|
60
|
-
targetBranch:
|
|
61
|
-
description: 'The target branch determined from config'
|
|
62
|
-
value: \${{ steps.read-config.outputs.targetBranch }}
|
|
63
|
-
autoMerge:
|
|
64
|
-
description: 'The autoMerge setting for the target branch'
|
|
65
|
-
value: \${{ steps.read-config.outputs.autoMerge }}
|
|
66
64
|
|
|
67
65
|
runs:
|
|
68
66
|
using: 'composite'
|
|
@@ -73,55 +71,6 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
73
71
|
fetch-depth: 0
|
|
74
72
|
token: \${{ inputs.token }}
|
|
75
73
|
|
|
76
|
-
- name: Read Config and Determine Target Branch
|
|
77
|
-
id: read-config
|
|
78
|
-
shell: bash
|
|
79
|
-
run: |
|
|
80
|
-
SOURCE="\${{ inputs.sourceBranch }}"
|
|
81
|
-
CONFIG_PATH="\${{ inputs.configPath }}"
|
|
82
|
-
|
|
83
|
-
echo "📖 Reading config from \$CONFIG_PATH"
|
|
84
|
-
|
|
85
|
-
# Check if config file exists
|
|
86
|
-
if [ ! -f "\$CONFIG_PATH" ]; then
|
|
87
|
-
echo "❌ Config file not found: \$CONFIG_PATH"
|
|
88
|
-
exit 1
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
# Read branchFlow array from config
|
|
92
|
-
BRANCH_FLOW=\$(cat "\$CONFIG_PATH" | jq -r '.branchFlow | join(" ")')
|
|
93
|
-
echo "🔍 Branch flow: \$BRANCH_FLOW"
|
|
94
|
-
|
|
95
|
-
# Convert to array
|
|
96
|
-
IFS=' ' read -ra BRANCHES <<< "\$BRANCH_FLOW"
|
|
97
|
-
|
|
98
|
-
# Find current branch index and determine target
|
|
99
|
-
TARGET=""
|
|
100
|
-
for i in "\${!BRANCHES[@]}"; do
|
|
101
|
-
if [ "\${BRANCHES[\$i]}" == "\$SOURCE" ]; then
|
|
102
|
-
# Get next branch in flow
|
|
103
|
-
NEXT_INDEX=\$((i + 1))
|
|
104
|
-
if [ \$NEXT_INDEX -lt \${#BRANCHES[@]} ]; then
|
|
105
|
-
TARGET="\${BRANCHES[\$NEXT_INDEX]}"
|
|
106
|
-
fi
|
|
107
|
-
break
|
|
108
|
-
fi
|
|
109
|
-
done
|
|
110
|
-
|
|
111
|
-
if [ -z "\$TARGET" ]; then
|
|
112
|
-
echo "❌ Could not determine target branch for source: \$SOURCE"
|
|
113
|
-
echo " Branch flow: \$BRANCH_FLOW"
|
|
114
|
-
exit 1
|
|
115
|
-
fi
|
|
116
|
-
|
|
117
|
-
echo "✅ Target branch: \$TARGET"
|
|
118
|
-
echo "targetBranch=\$TARGET" >> \$GITHUB_OUTPUT
|
|
119
|
-
|
|
120
|
-
# Determine autoMerge setting for target branch
|
|
121
|
-
AUTO_MERGE=\$(cat "\$CONFIG_PATH" | jq -r ".autoMerge.\"\$TARGET\" // false")
|
|
122
|
-
echo "🔍 Auto-merge for \$TARGET: \$AUTO_MERGE"
|
|
123
|
-
echo "autoMerge=\$AUTO_MERGE" >> \$GITHUB_OUTPUT
|
|
124
|
-
|
|
125
74
|
- name: Get Version
|
|
126
75
|
id: get-version
|
|
127
76
|
shell: bash
|
|
@@ -144,7 +93,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
144
93
|
shell: bash
|
|
145
94
|
run: |
|
|
146
95
|
SOURCE="\${{ inputs.sourceBranch }}"
|
|
147
|
-
TARGET="\${{
|
|
96
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
148
97
|
VERSION="\${{ steps.get-version.outputs.version }}"
|
|
149
98
|
PATTERN="\${{ inputs.tempBranchPattern }}"
|
|
150
99
|
|
|
@@ -189,7 +138,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
189
138
|
GH_TOKEN: \${{ inputs.token }}
|
|
190
139
|
run: |
|
|
191
140
|
TEMP_BRANCH="\${{ steps.create-temp.outputs.tempBranch }}"
|
|
192
|
-
TARGET="\${{
|
|
141
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
193
142
|
|
|
194
143
|
# Check if PR already exists from temp branch to target
|
|
195
144
|
EXISTING_PR=\$(gh pr list --head "\$TEMP_BRANCH" --base "\$TARGET" --json number --jq '.[0].number' 2>/dev/null || echo "")
|
|
@@ -215,10 +164,10 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
215
164
|
GH_TOKEN: \${{ inputs.token }}
|
|
216
165
|
run: |
|
|
217
166
|
TEMP_BRANCH="\${{ steps.create-temp.outputs.tempBranch }}"
|
|
218
|
-
TARGET="\${{
|
|
167
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
219
168
|
SOURCE="\${{ inputs.sourceBranch }}"
|
|
220
169
|
VERSION="\${{ steps.get-version.outputs.version }}"
|
|
221
|
-
AUTO_MERGE="\${{
|
|
170
|
+
AUTO_MERGE="\${{ inputs.autoMerge }}"
|
|
222
171
|
|
|
223
172
|
TITLE="🚀 Release \$VERSION to \$TARGET"
|
|
224
173
|
|
|
@@ -258,13 +207,13 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
258
207
|
fi
|
|
259
208
|
|
|
260
209
|
- name: Enable PR Auto-Merge with Rebase (Manual Approval Required)
|
|
261
|
-
if:
|
|
210
|
+
if: inputs.autoMerge == 'false'
|
|
262
211
|
shell: bash
|
|
263
212
|
env:
|
|
264
213
|
GH_TOKEN: \${{ inputs.token }}
|
|
265
214
|
run: |
|
|
266
215
|
PR_NUMBER="\${{ steps.check-pr.outputs.prNumber || steps.create-pr.outputs.prNumber }}"
|
|
267
|
-
TARGET="\${{
|
|
216
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
268
217
|
|
|
269
218
|
echo "🔐 Enabling auto-merge with rebase for PR #\$PR_NUMBER (requires approval)"
|
|
270
219
|
echo " This will fast-forward \$TARGET when approved, maintaining linear history"
|
|
@@ -276,11 +225,11 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
276
225
|
echo "⚠️ Manual approval required before merge completes"
|
|
277
226
|
|
|
278
227
|
- name: Fast-Forward Merge (Immediate Auto-Merge)
|
|
279
|
-
if:
|
|
228
|
+
if: inputs.autoMerge == 'true'
|
|
280
229
|
shell: bash
|
|
281
230
|
run: |
|
|
282
231
|
SOURCE="\${{ inputs.sourceBranch }}"
|
|
283
|
-
TARGET="\${{
|
|
232
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
284
233
|
VERSION="\${{ steps.get-version.outputs.version }}"
|
|
285
234
|
|
|
286
235
|
echo "🚀 Fast-forwarding \$TARGET to \$SOURCE (maintaining linear history)"
|
|
@@ -314,7 +263,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
314
263
|
echo "📝 PR will be closed automatically for audit trail"
|
|
315
264
|
|
|
316
265
|
- name: Wait for Branch to Propagate
|
|
317
|
-
if:
|
|
266
|
+
if: inputs.autoMerge == 'true'
|
|
318
267
|
shell: bash
|
|
319
268
|
run: |
|
|
320
269
|
echo "⏳ Waiting 5 seconds for branch update to propagate..."
|
|
@@ -322,12 +271,12 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
322
271
|
echo "✅ Branch should be fully propagated"
|
|
323
272
|
|
|
324
273
|
- name: Trigger Pipeline Workflow on Target Branch
|
|
325
|
-
if:
|
|
274
|
+
if: inputs.autoMerge == 'true'
|
|
326
275
|
shell: bash
|
|
327
276
|
env:
|
|
328
277
|
GH_TOKEN: \${{ inputs.token }}
|
|
329
278
|
run: |
|
|
330
|
-
TARGET="\${{
|
|
279
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
331
280
|
VERSION="\${{ steps.get-version.outputs.version }}"
|
|
332
281
|
RUN_NUMBER="\${{ inputs.run_number }}"
|
|
333
282
|
|
|
@@ -352,7 +301,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
352
301
|
echo "✅ Pipeline workflow triggered on \$TARGET with version \$VERSION at commit \$COMMIT_SHA"
|
|
353
302
|
|
|
354
303
|
- name: Close PR and Delete Branch
|
|
355
|
-
if:
|
|
304
|
+
if: inputs.autoMerge == 'true'
|
|
356
305
|
shell: bash
|
|
357
306
|
env:
|
|
358
307
|
GH_TOKEN: \${{ inputs.token }}
|
|
@@ -393,13 +342,15 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
393
342
|
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
394
343
|
*/
|
|
395
344
|
export const generate = (ctx) => Promise.resolve(ctx)
|
|
396
|
-
.then(
|
|
345
|
+
.then(ctx => {
|
|
397
346
|
// Check if file exists to determine merge status
|
|
398
|
-
const
|
|
347
|
+
const config = ctx.config || {};
|
|
348
|
+
const outputDir = getActionOutputDir(config);
|
|
349
|
+
const filePath = `${outputDir}/promote-branch/action.yml`;
|
|
399
350
|
const exists = fs.existsSync(filePath);
|
|
400
351
|
const status = exists ? '🔄 Merged with existing' : '📝 Created new';
|
|
401
352
|
logger.verbose(`${status} ${filePath}`);
|
|
402
|
-
return ctx;
|
|
353
|
+
return { ...ctx, actionOutputPath: filePath };
|
|
403
354
|
})
|
|
404
|
-
.then(renderTemplate(promoteBranchActionTemplate, toFile('
|
|
355
|
+
.then(ctx => renderTemplate(promoteBranchActionTemplate, toFile(ctx.actionOutputPath || 'actions/promote-branch/action.yml'))(ctx));
|
|
405
356
|
//# sourceMappingURL=promote-branch.yml.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote-branch.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/promote-branch.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"promote-branch.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/promote-branch.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAGpE;;;;;GAKG;AACH,MAAM,2BAA2B,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC/C,OAAO,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2TZ,CAAA;AACH,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA0D,EAAE,EAAE,CACrF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;KACjB,IAAI,CAAC,GAAG,CAAC,EAAE;IACV,iDAAiD;IACjD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAA;IAC/B,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,QAAQ,GAAG,GAAG,SAAS,4BAA4B,CAAA;IACzD,MAAM,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,gBAAgB,CAAA;IACpE,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAC,CAAA;IACvC,OAAO,EAAE,GAAG,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAA;AAC/C,CAAC,CAAC;KACD,IAAI,CAAC,GAAG,CAAC,EAAE,CACV,cAAc,CACZ,2BAA2B,EAC3B,MAAM,CAAC,GAAG,CAAC,gBAAgB,IAAI,mCAAmC,CAAC,CACpE,CAAC,GAAG,CAAC,CACP,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run Nx Affected Action Template
|
|
3
|
+
*
|
|
4
|
+
* Generates a reusable GitHub composite action that runs Nx affected commands
|
|
5
|
+
* with caching, reporting, and proper error handling.
|
|
6
|
+
*
|
|
7
|
+
* ## Purpose
|
|
8
|
+
*
|
|
9
|
+
* This action encapsulates all the complexity of running Nx affected tasks:
|
|
10
|
+
* - Sets up package manager caching (pnpm store)
|
|
11
|
+
* - Configures Nx workspace caching
|
|
12
|
+
* - Runs multiple Nx targets with proper comparison base
|
|
13
|
+
* - Reports results as PR comments
|
|
14
|
+
* - Handles failures gracefully with continue-on-error
|
|
15
|
+
*
|
|
16
|
+
* ## Generated Action Location
|
|
17
|
+
*
|
|
18
|
+
* `actions/run-nx-affected/action.yml`
|
|
19
|
+
*
|
|
20
|
+
* @module templates/actions/run-nx-affected.yml.tpl
|
|
21
|
+
*/
|
|
22
|
+
import { type PinionContext } from '@featherscloud/pinion';
|
|
23
|
+
import type { PipecraftConfig } from '../../types/index.js';
|
|
24
|
+
/**
|
|
25
|
+
* Generator entry point for run-nx-affected composite action.
|
|
26
|
+
*
|
|
27
|
+
* @param {PinionContext} ctx - Pinion generator context
|
|
28
|
+
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
29
|
+
*/
|
|
30
|
+
export declare const generate: (ctx: PinionContext & {
|
|
31
|
+
config?: Partial<PipecraftConfig>;
|
|
32
|
+
}) => Promise<PinionContext>;
|
|
33
|
+
//# sourceMappingURL=run-nx-affected.yml.tpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-nx-affected.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/run-nx-affected.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAIlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAkT3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,2BAgB9E,CAAA"}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run Nx Affected Action Template
|
|
3
|
+
*
|
|
4
|
+
* Generates a reusable GitHub composite action that runs Nx affected commands
|
|
5
|
+
* with caching, reporting, and proper error handling.
|
|
6
|
+
*
|
|
7
|
+
* ## Purpose
|
|
8
|
+
*
|
|
9
|
+
* This action encapsulates all the complexity of running Nx affected tasks:
|
|
10
|
+
* - Sets up package manager caching (pnpm store)
|
|
11
|
+
* - Configures Nx workspace caching
|
|
12
|
+
* - Runs multiple Nx targets with proper comparison base
|
|
13
|
+
* - Reports results as PR comments
|
|
14
|
+
* - Handles failures gracefully with continue-on-error
|
|
15
|
+
*
|
|
16
|
+
* ## Generated Action Location
|
|
17
|
+
*
|
|
18
|
+
* `actions/run-nx-affected/action.yml`
|
|
19
|
+
*
|
|
20
|
+
* @module templates/actions/run-nx-affected.yml.tpl
|
|
21
|
+
*/
|
|
22
|
+
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
23
|
+
import fs from 'fs';
|
|
24
|
+
import { logger } from '../../utils/logger.js';
|
|
25
|
+
import { getActionOutputDir } from '../../utils/action-reference.js';
|
|
26
|
+
/**
|
|
27
|
+
* Generates the run-nx-affected composite action YAML content.
|
|
28
|
+
*/
|
|
29
|
+
/* eslint-disable no-useless-escape */
|
|
30
|
+
function runNxAffectedActionTemplate(ctx) {
|
|
31
|
+
return `name: 'Run Nx Affected'
|
|
32
|
+
description: 'Runs Nx affected commands with caching and reporting'
|
|
33
|
+
|
|
34
|
+
inputs:
|
|
35
|
+
targets:
|
|
36
|
+
description: 'Comma-separated list of Nx targets to run (e.g., "lint,test,build")'
|
|
37
|
+
required: true
|
|
38
|
+
baseRef:
|
|
39
|
+
description: 'Base reference for comparison'
|
|
40
|
+
required: false
|
|
41
|
+
default: 'origin/main'
|
|
42
|
+
commitSha:
|
|
43
|
+
description: 'Commit SHA to test'
|
|
44
|
+
required: false
|
|
45
|
+
default: \${{ github.sha }}
|
|
46
|
+
packageManager:
|
|
47
|
+
description: 'Package manager to use (npm, pnpm, yarn)'
|
|
48
|
+
required: false
|
|
49
|
+
default: 'pnpm'
|
|
50
|
+
enableCache:
|
|
51
|
+
description: 'Enable caching for dependencies and Nx'
|
|
52
|
+
required: false
|
|
53
|
+
default: 'true'
|
|
54
|
+
reportResults:
|
|
55
|
+
description: 'Post results as PR comment (only works on pull_request events)'
|
|
56
|
+
required: false
|
|
57
|
+
default: 'true'
|
|
58
|
+
exclude:
|
|
59
|
+
description: 'Comma-separated list of Nx projects to exclude (e.g., "@mf/app1,@mf/lib2")'
|
|
60
|
+
required: false
|
|
61
|
+
default: ''
|
|
62
|
+
node-version:
|
|
63
|
+
description: 'Node.js version to use'
|
|
64
|
+
required: false
|
|
65
|
+
default: '20'
|
|
66
|
+
pnpm-version:
|
|
67
|
+
description: 'pnpm version to use'
|
|
68
|
+
required: false
|
|
69
|
+
default: '9'
|
|
70
|
+
verbose:
|
|
71
|
+
description: 'Enable verbose logging for debugging affected detection'
|
|
72
|
+
required: false
|
|
73
|
+
default: 'false'
|
|
74
|
+
|
|
75
|
+
runs:
|
|
76
|
+
using: composite
|
|
77
|
+
steps:
|
|
78
|
+
- name: Setup Node.js
|
|
79
|
+
uses: actions/setup-node@v4
|
|
80
|
+
with:
|
|
81
|
+
node-version: \${{ inputs.node-version }}
|
|
82
|
+
|
|
83
|
+
- name: Enable Corepack
|
|
84
|
+
if: inputs.packageManager == 'pnpm'
|
|
85
|
+
shell: bash
|
|
86
|
+
run: corepack enable
|
|
87
|
+
|
|
88
|
+
- name: Get pnpm store directory
|
|
89
|
+
if: inputs.packageManager == 'pnpm' && inputs.enableCache == 'true'
|
|
90
|
+
id: pnpm-cache
|
|
91
|
+
shell: bash
|
|
92
|
+
run: |
|
|
93
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
|
|
94
|
+
|
|
95
|
+
- name: Cache Package Manager
|
|
96
|
+
if: inputs.enableCache == 'true'
|
|
97
|
+
uses: actions/cache@v4
|
|
98
|
+
with:
|
|
99
|
+
path: \${{ inputs.packageManager == 'pnpm' && steps.pnpm-cache.outputs.STORE_PATH || '~/.npm' }}
|
|
100
|
+
key: \${{ inputs.packageManager }}-\${{ runner.os }}-\${{ hashFiles(inputs.packageManager == 'pnpm' && 'pnpm-lock.yaml' || inputs.packageManager == 'yarn' && 'yarn.lock' || 'package-lock.json') }}
|
|
101
|
+
restore-keys: |
|
|
102
|
+
\${{ inputs.packageManager }}-\${{ runner.os }}-
|
|
103
|
+
|
|
104
|
+
- name: Install Dependencies
|
|
105
|
+
shell: bash
|
|
106
|
+
run: |
|
|
107
|
+
case "\${{ inputs.packageManager }}" in
|
|
108
|
+
pnpm)
|
|
109
|
+
pnpm install --frozen-lockfile || pnpm install
|
|
110
|
+
;;
|
|
111
|
+
yarn)
|
|
112
|
+
yarn install --frozen-lockfile || yarn install
|
|
113
|
+
;;
|
|
114
|
+
npm)
|
|
115
|
+
npm ci || npm install
|
|
116
|
+
;;
|
|
117
|
+
*)
|
|
118
|
+
npm install
|
|
119
|
+
;;
|
|
120
|
+
esac
|
|
121
|
+
|
|
122
|
+
- name: Cache Nx
|
|
123
|
+
if: inputs.enableCache == 'true'
|
|
124
|
+
uses: actions/cache@v4
|
|
125
|
+
with:
|
|
126
|
+
path: .nx/cache
|
|
127
|
+
key: nx-\${{ runner.os }}-\${{ hashFiles(inputs.packageManager == 'pnpm' && 'pnpm-lock.yaml' || inputs.packageManager == 'yarn' && 'yarn.lock' || 'package-lock.json') }}-\${{ github.ref_name }}-\${{ github.run_number }}
|
|
128
|
+
restore-keys: |
|
|
129
|
+
nx-\${{ runner.os }}-\${{ hashFiles(inputs.packageManager == 'pnpm' && 'pnpm-lock.yaml' || inputs.packageManager == 'yarn' && 'yarn.lock' || 'package-lock.json') }}-\${{ github.ref_name }}-
|
|
130
|
+
nx-\${{ runner.os }}-\${{ hashFiles(inputs.packageManager == 'pnpm' && 'pnpm-lock.yaml' || inputs.packageManager == 'yarn' && 'yarn.lock' || 'package-lock.json') }}-
|
|
131
|
+
nx-\${{ runner.os }}-
|
|
132
|
+
|
|
133
|
+
- name: Show Nx Comparison Info
|
|
134
|
+
if: inputs.verbose == 'true'
|
|
135
|
+
shell: bash
|
|
136
|
+
run: |
|
|
137
|
+
echo "=========================================="
|
|
138
|
+
echo "🔍 Nx Affected Analysis Configuration"
|
|
139
|
+
echo "=========================================="
|
|
140
|
+
echo ""
|
|
141
|
+
echo "📌 Current HEAD:"
|
|
142
|
+
echo " Commit: \${{ inputs.commitSha }}"
|
|
143
|
+
git log -1 --oneline \${{ inputs.commitSha }} || echo " (commit details unavailable)"
|
|
144
|
+
echo ""
|
|
145
|
+
echo "📌 Base for comparison:"
|
|
146
|
+
BASE_REF="\${{ inputs.baseRef }}"
|
|
147
|
+
echo " Base ref: $BASE_REF"
|
|
148
|
+
git log -1 --oneline $BASE_REF || echo " (base ref details unavailable)"
|
|
149
|
+
echo ""
|
|
150
|
+
echo "📊 Commits being analyzed:"
|
|
151
|
+
git log --oneline $BASE_REF..\${{ inputs.commitSha }} || echo " (unable to show commit range)"
|
|
152
|
+
echo ""
|
|
153
|
+
echo "🎯 Targets to run: \${{ inputs.targets }}"
|
|
154
|
+
if [ -n "\${{ inputs.exclude }}" ]; then
|
|
155
|
+
echo "🚫 Excluding projects: \${{ inputs.exclude }}"
|
|
156
|
+
fi
|
|
157
|
+
echo "=========================================="
|
|
158
|
+
|
|
159
|
+
- name: Run Nx Affected Targets
|
|
160
|
+
id: nx-run
|
|
161
|
+
shell: bash
|
|
162
|
+
run: |
|
|
163
|
+
# Parse targets into array
|
|
164
|
+
IFS=',' read -ra TARGETS <<< "\${{ inputs.targets }}"
|
|
165
|
+
|
|
166
|
+
# Get the command prefix based on package manager
|
|
167
|
+
if [ "\${{ inputs.packageManager }}" = "pnpm" ]; then
|
|
168
|
+
NX_CMD="pnpm exec nx"
|
|
169
|
+
else
|
|
170
|
+
NX_CMD="npx nx"
|
|
171
|
+
fi
|
|
172
|
+
|
|
173
|
+
# Build exclude flag if provided (strip spaces for comma-separated list)
|
|
174
|
+
EXCLUDE_FLAG=""
|
|
175
|
+
if [ -n "\${{ inputs.exclude }}" ]; then
|
|
176
|
+
EXCLUDE_LIST=$(echo "\${{ inputs.exclude }}" | tr -d ' ')
|
|
177
|
+
EXCLUDE_FLAG="--exclude=$EXCLUDE_LIST"
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
# Track overall success
|
|
181
|
+
OVERALL_SUCCESS=true
|
|
182
|
+
RESULTS_JSON="{"
|
|
183
|
+
FAILED_LOGS_JSON="{"
|
|
184
|
+
|
|
185
|
+
# Run each target
|
|
186
|
+
for target in "\${TARGETS[@]}"; do
|
|
187
|
+
# Trim whitespace
|
|
188
|
+
target=$(echo "$target" | xargs)
|
|
189
|
+
|
|
190
|
+
echo ""
|
|
191
|
+
echo "=========================================="
|
|
192
|
+
echo "🎯 Running target: $target"
|
|
193
|
+
echo "=========================================="
|
|
194
|
+
|
|
195
|
+
# Capture output to a temp file
|
|
196
|
+
LOG_FILE=$(mktemp)
|
|
197
|
+
|
|
198
|
+
# Run the target and capture result
|
|
199
|
+
if $NX_CMD affected --target=$target --base=\${{ inputs.baseRef }} --head=\${{ inputs.commitSha }} $EXCLUDE_FLAG 2>&1 | tee "$LOG_FILE"; then
|
|
200
|
+
echo "✅ $target passed"
|
|
201
|
+
RESULTS_JSON+="\"$target\":\"success\","
|
|
202
|
+
else
|
|
203
|
+
echo "❌ $target failed"
|
|
204
|
+
RESULTS_JSON+="\"$target\":\"failure\","
|
|
205
|
+
OVERALL_SUCCESS=false
|
|
206
|
+
|
|
207
|
+
# Extract and store the failure log (last 100 lines, strip ANSI codes, escape for JSON)
|
|
208
|
+
FAILURE_LOG=$(tail -n 100 "$LOG_FILE" | sed 's/\\x1b\\[[0-9;]*m//g' | sed 's/\\\\/\\\\\\\\/g' | sed 's/"/\\\\"/g' | sed ':a;N;$!ba;s/\\n/\\\\n/g')
|
|
209
|
+
FAILED_LOGS_JSON+="\"$target\":\"$FAILURE_LOG\","
|
|
210
|
+
fi
|
|
211
|
+
|
|
212
|
+
rm -f "$LOG_FILE"
|
|
213
|
+
done
|
|
214
|
+
|
|
215
|
+
# Close JSON and save to output
|
|
216
|
+
RESULTS_JSON="\${RESULTS_JSON%,}}"
|
|
217
|
+
echo "results=$RESULTS_JSON" >> $GITHUB_OUTPUT
|
|
218
|
+
|
|
219
|
+
FAILED_LOGS_JSON="\${FAILED_LOGS_JSON%,}}"
|
|
220
|
+
if [ "$FAILED_LOGS_JSON" != "{" ]; then
|
|
221
|
+
FAILED_LOGS_JSON+="}"
|
|
222
|
+
fi
|
|
223
|
+
# Use delimiter for multiline output
|
|
224
|
+
echo "failed_logs<<EOF" >> $GITHUB_OUTPUT
|
|
225
|
+
echo "$FAILED_LOGS_JSON" >> $GITHUB_OUTPUT
|
|
226
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
227
|
+
|
|
228
|
+
# Set overall success
|
|
229
|
+
if [ "$OVERALL_SUCCESS" = "false" ]; then
|
|
230
|
+
echo "overall_success=false" >> $GITHUB_OUTPUT
|
|
231
|
+
exit 1
|
|
232
|
+
else
|
|
233
|
+
echo "overall_success=true" >> $GITHUB_OUTPUT
|
|
234
|
+
fi
|
|
235
|
+
|
|
236
|
+
- name: Report Results to PR
|
|
237
|
+
if: always() && inputs.reportResults == 'true' && github.event_name == 'pull_request'
|
|
238
|
+
uses: actions/github-script@v7
|
|
239
|
+
with:
|
|
240
|
+
script: |
|
|
241
|
+
const results = \${{ steps.nx-run.outputs.results || '{}' }};
|
|
242
|
+
const failedLogs = \${{ steps.nx-run.outputs.failed_logs || '{}' }};
|
|
243
|
+
const targets = '\${{ inputs.targets }}'.split(',').map(t => t.trim());
|
|
244
|
+
const exclude = '\${{ inputs.exclude }}';
|
|
245
|
+
|
|
246
|
+
let report = '## 🔍 Nx Affected Test Results\\n\\n';
|
|
247
|
+
let hasFailures = false;
|
|
248
|
+
const failedTargets = [];
|
|
249
|
+
|
|
250
|
+
for (const target of targets) {
|
|
251
|
+
const status = results[target];
|
|
252
|
+
if (status === 'failure') {
|
|
253
|
+
report += \`❌ **\${target}** - Failed\\n\`;
|
|
254
|
+
hasFailures = true;
|
|
255
|
+
failedTargets.push(target);
|
|
256
|
+
} else if (status === 'success') {
|
|
257
|
+
report += \`✅ **\${target}** - Passed\\n\`;
|
|
258
|
+
} else {
|
|
259
|
+
report += \`⚠️ **\${target}** - Unknown\\n\`;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Add failure details with collapsible sections
|
|
264
|
+
if (failedTargets.length > 0) {
|
|
265
|
+
report += \`\\n### ❌ Failure Details\\n\\n\`;
|
|
266
|
+
|
|
267
|
+
for (const target of failedTargets) {
|
|
268
|
+
const log = failedLogs[target];
|
|
269
|
+
|
|
270
|
+
// Link to full logs for this specific target
|
|
271
|
+
report += \`#### \${target}\\n\`;
|
|
272
|
+
report += \`[View full logs for \${target}](\${context.serverUrl}/\${context.repo.owner}/\${context.repo.repo}/actions/runs/\${context.runId})\\n\\n\`;
|
|
273
|
+
|
|
274
|
+
// Collapsible section with error output
|
|
275
|
+
if (log) {
|
|
276
|
+
report += \`<details>\\n\`;
|
|
277
|
+
report += \`<summary>Show error output</summary>\\n\\n\`;
|
|
278
|
+
report += \`\\\`\\\`\\\`\\n\`;
|
|
279
|
+
report += log;
|
|
280
|
+
report += \`\\n\\\`\\\`\\\`\\n\`;
|
|
281
|
+
report += \`</details>\\n\\n\`;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (exclude) {
|
|
287
|
+
report += \`\\n### Excluded Projects\\n\`;
|
|
288
|
+
const excludedProjects = exclude.split(',').map(p => p.trim());
|
|
289
|
+
report += \`The following projects were skipped from the affected analysis:\\n\`;
|
|
290
|
+
excludedProjects.forEach(project => {
|
|
291
|
+
report += \`- \\\`\${project}\\\`\\n\`;
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
report += \`\\n---\\n[View full workflow run](\${context.serverUrl}/\${context.repo.owner}/\${context.repo.repo}/actions/runs/\${context.runId})\\n\`;
|
|
296
|
+
|
|
297
|
+
// Find existing comment
|
|
298
|
+
const { data: comments } = await github.rest.issues.listComments({
|
|
299
|
+
owner: context.repo.owner,
|
|
300
|
+
repo: context.repo.repo,
|
|
301
|
+
issue_number: context.issue.number,
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
const botComment = comments.find(comment =>
|
|
305
|
+
comment.user.type === 'Bot' &&
|
|
306
|
+
comment.body.includes('🔍 Nx Affected Test Results')
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
if (botComment) {
|
|
310
|
+
// Update existing comment
|
|
311
|
+
await github.rest.issues.updateComment({
|
|
312
|
+
owner: context.repo.owner,
|
|
313
|
+
repo: context.repo.repo,
|
|
314
|
+
comment_id: botComment.id,
|
|
315
|
+
body: report
|
|
316
|
+
});
|
|
317
|
+
} else {
|
|
318
|
+
// Create new comment
|
|
319
|
+
await github.rest.issues.createComment({
|
|
320
|
+
owner: context.repo.owner,
|
|
321
|
+
repo: context.repo.repo,
|
|
322
|
+
issue_number: context.issue.number,
|
|
323
|
+
body: report
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
`;
|
|
327
|
+
}
|
|
328
|
+
/* eslint-enable no-useless-escape */
|
|
329
|
+
/**
|
|
330
|
+
* Generator entry point for run-nx-affected composite action.
|
|
331
|
+
*
|
|
332
|
+
* @param {PinionContext} ctx - Pinion generator context
|
|
333
|
+
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
334
|
+
*/
|
|
335
|
+
export const generate = (ctx) => Promise.resolve(ctx)
|
|
336
|
+
.then(ctx => {
|
|
337
|
+
const config = ctx.config || {};
|
|
338
|
+
const outputDir = getActionOutputDir(config);
|
|
339
|
+
const filePath = `${outputDir}/run-nx-affected/action.yml`;
|
|
340
|
+
const exists = fs.existsSync(filePath);
|
|
341
|
+
const status = exists ? '🔄 Merged with existing' : '📝 Created new';
|
|
342
|
+
logger.verbose(`${status} ${filePath}`);
|
|
343
|
+
return { ...ctx, actionOutputPath: filePath };
|
|
344
|
+
})
|
|
345
|
+
.then(ctx => renderTemplate(runNxAffectedActionTemplate, toFile(ctx.actionOutputPath || 'actions/run-nx-affected/action.yml'))(ctx));
|
|
346
|
+
//# sourceMappingURL=run-nx-affected.yml.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-nx-affected.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/run-nx-affected.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAGpE;;GAEG;AACH,sCAAsC;AACtC,SAAS,2BAA2B,CAAC,GAAkB;IACrD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuSR,CAAA;AACD,CAAC;AACD,qCAAqC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA0D,EAAE,EAAE,CACrF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;KACjB,IAAI,CAAC,GAAG,CAAC,EAAE;IACV,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAA;IAC/B,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,QAAQ,GAAG,GAAG,SAAS,6BAA6B,CAAA;IAC1D,MAAM,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,gBAAgB,CAAA;IACpE,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAC,CAAA;IACvC,OAAO,EAAE,GAAG,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAA;AAC/C,CAAC,CAAC;KACD,IAAI,CAAC,GAAG,CAAC,EAAE,CACV,cAAc,CACZ,2BAA2B,EAC3B,MAAM,CAAC,GAAG,CAAC,gBAAgB,IAAI,oCAAoC,CAAC,CACrE,CAAC,GAAG,CAAC,CACP,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-it.cjs.tpl.d.ts","sourceRoot":"","sources":["../../src/templates/release-it.cjs.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"release-it.cjs.tpl.d.ts","sourceRoot":"","sources":["../../src/templates/release-it.cjs.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAwGlF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,iBAUrC,CAAA"}
|