pipecraft 0.36.2 → 0.36.15
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 +30 -20
- package/dist/cli/index.js +4 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/init.tpl.d.ts.map +1 -1
- package/dist/generators/init.tpl.js +7 -128
- package/dist/generators/init.tpl.js.map +1 -1
- package/dist/generators/workflows.tpl.d.ts.map +1 -1
- package/dist/generators/workflows.tpl.js +3 -15
- package/dist/generators/workflows.tpl.js.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.js +38 -19
- package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
- 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.map +1 -1
- package/dist/templates/actions/create-release.yml.tpl.js +11 -9
- package/dist/templates/actions/create-release.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.js +8 -7
- package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts +7 -13
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.js +62 -215
- package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.js +8 -7
- package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.js +25 -29
- package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
- package/dist/templates/release-it.cjs.tpl.d.ts.map +1 -1
- package/dist/templates/release-it.cjs.tpl.js +14 -3
- package/dist/templates/release-it.cjs.tpl.js.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.js +28 -48
- package/dist/templates/workflows/pipeline.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/shared/index.d.ts +1 -0
- package/dist/templates/workflows/shared/index.d.ts.map +1 -1
- package/dist/templates/workflows/shared/index.js +1 -0
- package/dist/templates/workflows/shared/index.js.map +1 -1
- package/dist/templates/workflows/shared/managed-workflow.d.ts +32 -0
- package/dist/templates/workflows/shared/managed-workflow.d.ts.map +1 -0
- package/dist/templates/workflows/shared/managed-workflow.js +51 -0
- package/dist/templates/workflows/shared/managed-workflow.js.map +1 -0
- package/dist/templates/workflows/shared/operations-changes.d.ts +0 -1
- package/dist/templates/workflows/shared/operations-changes.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.js +1 -6
- package/dist/templates/workflows/shared/operations-changes.js.map +1 -1
- package/dist/templates/workflows/shared/operations-gate.d.ts +4 -30
- package/dist/templates/workflows/shared/operations-gate.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-gate.js +110 -71
- package/dist/templates/workflows/shared/operations-gate.js.map +1 -1
- package/dist/templates/workflows/shared/operations-header.d.ts +10 -0
- package/dist/templates/workflows/shared/operations-header.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-header.js +22 -3
- package/dist/templates/workflows/shared/operations-header.js.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts +1 -4
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.js +21 -17
- package/dist/templates/workflows/shared/operations-tag-promote.js.map +1 -1
- package/dist/templates/workflows/shared/operations-version.d.ts +0 -1
- package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-version.js +4 -11
- 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 +1 -5
- package/dist/templates/yaml-format-utils.js.map +1 -1
- package/dist/types/index.d.ts +16 -57
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/action-reference.d.ts +1 -1
- package/dist/utils/action-reference.js +2 -2
- package/dist/utils/action-reference.js.map +1 -1
- package/dist/utils/config.d.ts +5 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +36 -4
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/github-setup.d.ts +4 -4
- package/dist/utils/github-setup.js +28 -28
- package/dist/utils/github-setup.js.map +1 -1
- package/dist/utils/messaging.d.ts +2 -2
- package/dist/utils/messaging.d.ts.map +1 -1
- package/dist/utils/messaging.js +5 -5
- package/dist/utils/messaging.js.map +1 -1
- package/dist/utils/preflight.js +2 -2
- package/dist/utils/preflight.js.map +1 -1
- package/dist/utils/workflow-semantics.d.ts +61 -0
- package/dist/utils/workflow-semantics.d.ts.map +1 -0
- package/dist/utils/workflow-semantics.js +230 -0
- package/dist/utils/workflow-semantics.js.map +1 -0
- package/package.json +6 -5
- package/src/generators/init.tpl.ts +7 -132
- package/src/generators/workflows.tpl.ts +3 -15
- package/dist/templates/actions/run-nx-affected.yml.tpl.d.ts +0 -33
- package/dist/templates/actions/run-nx-affected.yml.tpl.d.ts.map +0 -1
- package/dist/templates/actions/run-nx-affected.yml.tpl.js +0 -346
- package/dist/templates/actions/run-nx-affected.yml.tpl.js.map +0 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts +0 -22
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts.map +0 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js +0 -403
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js.map +0 -1
|
@@ -10,7 +10,7 @@ import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
|
10
10
|
import dedent from 'dedent';
|
|
11
11
|
import fs from 'fs';
|
|
12
12
|
import { logger } from '../../utils/logger.js';
|
|
13
|
-
import { getActionOutputDir } from '../../utils/action-reference.js';
|
|
13
|
+
import { getActionOutputDir, shouldGenerateActions } from '../../utils/action-reference.js';
|
|
14
14
|
/**
|
|
15
15
|
* Generates the create-pr composite action YAML content.
|
|
16
16
|
*
|
|
@@ -153,16 +153,19 @@ const createprActionTemplate = (ctx) => {
|
|
|
153
153
|
* @param {PinionContext} ctx - Pinion generator context
|
|
154
154
|
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
155
155
|
*/
|
|
156
|
-
export const generate = (ctx) => Promise.resolve(ctx)
|
|
157
|
-
.then(ctx => {
|
|
156
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(ctx => {
|
|
158
157
|
// Check if file exists to determine merge status
|
|
159
158
|
const config = ctx.config || {};
|
|
159
|
+
// Skip generation in remote mode - actions come from marketplace
|
|
160
|
+
if (!shouldGenerateActions(config)) {
|
|
161
|
+
logger.verbose('Skipping create-pr action generation (using remote actions)');
|
|
162
|
+
return ctx;
|
|
163
|
+
}
|
|
160
164
|
const outputDir = getActionOutputDir(config);
|
|
161
165
|
const filePath = `${outputDir}/create-pr/action.yml`;
|
|
162
166
|
const exists = fs.existsSync(filePath);
|
|
163
167
|
const status = exists ? '🔄 Merged with existing' : '📝 Created new';
|
|
164
168
|
logger.verbose(`${status} ${filePath}`);
|
|
165
|
-
return
|
|
166
|
-
})
|
|
167
|
-
.then(ctx => renderTemplate(createprActionTemplate, toFile(ctx.actionOutputPath || 'actions/create-pr/action.yml'))(ctx));
|
|
169
|
+
return renderTemplate(createprActionTemplate, toFile(filePath))(ctx);
|
|
170
|
+
});
|
|
168
171
|
//# sourceMappingURL=create-pr.yml.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-pr.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/create-pr.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;
|
|
1
|
+
{"version":3,"file":"create-pr.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/create-pr.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,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAG3F;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC1C,OAAO,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA+HA,CAAA;AACf,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA0D,EAAE,EAAE,CACrF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;IAC9B,iDAAiD;IACjD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAA;IAE/B,iEAAiE;IACjE,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,6DAA6D,CAAC,CAAA;QAC7E,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,QAAQ,GAAG,GAAG,SAAS,uBAAuB,CAAA;IACpD,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;IAEvC,OAAO,cAAc,CAAC,sBAAsB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACtE,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-release.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/create-release.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAKlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"create-release.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/create-release.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAKlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAmH3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,iBAgB/E,CAAA"}
|
|
@@ -11,7 +11,7 @@ import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
|
11
11
|
import dedent from 'dedent';
|
|
12
12
|
import fs from 'fs';
|
|
13
13
|
import { logger } from '../../utils/logger.js';
|
|
14
|
-
import { getActionOutputDir } from '../../utils/action-reference.js';
|
|
14
|
+
import { getActionOutputDir, shouldGenerateActions } from '../../utils/action-reference.js';
|
|
15
15
|
/**
|
|
16
16
|
* Generates the create-release composite action YAML content.
|
|
17
17
|
*
|
|
@@ -110,9 +110,10 @@ const releaseActionTemplate = (ctx) => {
|
|
|
110
110
|
if [ -f ".github/workflows/$PUBLISH_WORKFLOW" ]; then
|
|
111
111
|
echo "🔄 Triggering $PUBLISH_WORKFLOW for $VERSION"
|
|
112
112
|
|
|
113
|
-
# Trigger the publish workflow with the release tag
|
|
113
|
+
# Trigger the publish workflow with the release tag on main branch
|
|
114
114
|
# This is necessary because GITHUB_TOKEN release creation doesn't trigger workflows
|
|
115
|
-
|
|
115
|
+
# Explicitly use --ref main to ensure it runs on main, not the default branch (develop)
|
|
116
|
+
if gh workflow run "$PUBLISH_WORKFLOW" --ref main --field tag="$VERSION" 2>&1; then
|
|
116
117
|
echo "✅ Publish workflow triggered for $VERSION"
|
|
117
118
|
else
|
|
118
119
|
echo "⚠️ Failed to trigger publish workflow, but continuing"
|
|
@@ -129,16 +130,17 @@ const releaseActionTemplate = (ctx) => {
|
|
|
129
130
|
* @param {PinionContext} ctx - Pinion generator context
|
|
130
131
|
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
131
132
|
*/
|
|
132
|
-
export const generate = (ctx) => Promise.resolve(ctx)
|
|
133
|
-
.then(ctx => {
|
|
134
|
-
// Check if file exists to determine merge status
|
|
133
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(ctx => {
|
|
135
134
|
const config = ctx.config || {};
|
|
135
|
+
if (!shouldGenerateActions(config)) {
|
|
136
|
+
logger.verbose('Skipping create-release action generation (using remote actions)');
|
|
137
|
+
return ctx;
|
|
138
|
+
}
|
|
136
139
|
const outputDir = getActionOutputDir(config);
|
|
137
140
|
const filePath = `${outputDir}/create-release/action.yml`;
|
|
138
141
|
const exists = fs.existsSync(filePath);
|
|
139
142
|
const status = exists ? '🔄 Merged with existing' : '📝 Created new';
|
|
140
143
|
logger.verbose(`${status} ${filePath}`);
|
|
141
|
-
return
|
|
142
|
-
})
|
|
143
|
-
.then(ctx => renderTemplate(releaseActionTemplate, toFile(ctx.actionOutputPath || 'actions/create-release/action.yml'))(ctx));
|
|
144
|
+
return renderTemplate(releaseActionTemplate, toFile(filePath))(ctx);
|
|
145
|
+
});
|
|
144
146
|
//# sourceMappingURL=create-release.yml.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-release.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/create-release.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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;
|
|
1
|
+
{"version":3,"file":"create-release.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/create-release.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAG3F;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,CAAC,GAAQ,EAAE,EAAE;IACzC,OAAO,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAuGA,CAAA;AACf,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA0D,EAAE,EAAE,CACrF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;IAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAA;IAE/B,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,kEAAkE,CAAC,CAAA;QAClF,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,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;IAEvC,OAAO,cAAc,CAAC,qBAAqB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACrE,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-tag.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/create-tag.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAKlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAyG3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"create-tag.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/create-tag.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAKlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAyG3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,iBAgB/E,CAAA"}
|
|
@@ -10,7 +10,7 @@ import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
|
10
10
|
import dedent from 'dedent';
|
|
11
11
|
import fs from 'fs';
|
|
12
12
|
import { logger } from '../../utils/logger.js';
|
|
13
|
-
import { getActionOutputDir } from '../../utils/action-reference.js';
|
|
13
|
+
import { getActionOutputDir, shouldGenerateActions } from '../../utils/action-reference.js';
|
|
14
14
|
/**
|
|
15
15
|
* Generates the create-tag composite action YAML content.
|
|
16
16
|
*
|
|
@@ -119,16 +119,17 @@ const tagActionTemplate = (ctx) => {
|
|
|
119
119
|
* @param {PinionContext} ctx - Pinion generator context
|
|
120
120
|
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
121
121
|
*/
|
|
122
|
-
export const generate = (ctx) => Promise.resolve(ctx)
|
|
123
|
-
.then(ctx => {
|
|
124
|
-
// Check if file exists to determine merge status
|
|
122
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(ctx => {
|
|
125
123
|
const config = ctx.config || {};
|
|
124
|
+
if (!shouldGenerateActions(config)) {
|
|
125
|
+
logger.verbose('Skipping create-tag action generation (using remote actions)');
|
|
126
|
+
return ctx;
|
|
127
|
+
}
|
|
126
128
|
const outputDir = getActionOutputDir(config);
|
|
127
129
|
const filePath = `${outputDir}/create-tag/action.yml`;
|
|
128
130
|
const exists = fs.existsSync(filePath);
|
|
129
131
|
const status = exists ? '🔄 Merged with existing' : '📝 Created new';
|
|
130
132
|
logger.verbose(`${status} ${filePath}`);
|
|
131
|
-
return
|
|
132
|
-
})
|
|
133
|
-
.then(ctx => renderTemplate(tagActionTemplate, toFile(ctx.actionOutputPath || 'actions/create-tag/action.yml'))(ctx));
|
|
133
|
+
return renderTemplate(tagActionTemplate, toFile(filePath))(ctx);
|
|
134
|
+
});
|
|
134
135
|
//# sourceMappingURL=create-tag.yml.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-tag.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/create-tag.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;
|
|
1
|
+
{"version":3,"file":"create-tag.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/create-tag.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,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAG3F;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAAE,EAAE;IACrC,OAAO,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA6FA,CAAA;AACf,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA0D,EAAE,EAAE,CACrF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;IAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAA;IAE/B,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,8DAA8D,CAAC,CAAA;QAC9E,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,QAAQ,GAAG,GAAG,SAAS,wBAAwB,CAAA;IACrD,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;IAEvC,OAAO,cAAc,CAAC,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Detect Changes Action Template
|
|
3
3
|
*
|
|
4
|
-
* Generates a REUSABLE GitHub composite action that detects which domains have changed
|
|
5
|
-
*
|
|
4
|
+
* Generates a REUSABLE GitHub composite action that detects which domains have changed
|
|
5
|
+
* using path-based change detection with dorny/paths-filter.
|
|
6
6
|
*
|
|
7
7
|
* ## Purpose
|
|
8
8
|
*
|
|
9
|
-
* This action is **configuration-driven** and accepts domain definitions as
|
|
10
|
-
* making it truly reusable across any project without regeneration
|
|
11
|
-
*
|
|
12
|
-
* - For path-based projects: Uses path filters to detect which domains changed
|
|
13
|
-
* - Automatically falls back to path-based detection if Nx is unavailable
|
|
9
|
+
* This action is **configuration-driven** and accepts domain definitions as YAML input,
|
|
10
|
+
* making it truly reusable across any project without regeneration.
|
|
11
|
+
* It uses path filters to detect which domains changed based on file glob patterns.
|
|
14
12
|
*
|
|
15
13
|
* ## Key Design Principle
|
|
16
14
|
*
|
|
@@ -28,15 +26,11 @@ import type { PipecraftConfig } from '../../types/index.js';
|
|
|
28
26
|
/**
|
|
29
27
|
* Generator entry point for detect-changes composite action.
|
|
30
28
|
*
|
|
31
|
-
* Generates the
|
|
29
|
+
* Generates the \`actions/detect-changes/action.yml\` file with configuration-driven
|
|
32
30
|
* change detection logic. This action accepts domain configuration as input at runtime,
|
|
33
31
|
* making it truly reusable without regeneration.
|
|
34
32
|
*
|
|
35
|
-
*
|
|
36
|
-
* them as JSON input from the workflow, allowing the same action to work with any
|
|
37
|
-
* domain configuration.
|
|
38
|
-
*
|
|
39
|
-
* @param {PinionContext} ctx - Pinion generator context (domains no longer needed in template)
|
|
33
|
+
* @param {PinionContext} ctx - Pinion generator context
|
|
40
34
|
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
41
35
|
*/
|
|
42
36
|
export declare const generate: (ctx: PinionContext & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-changes.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/detect-changes.yml.tpl.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"detect-changes.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/detect-changes.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAIlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAmJ3D;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,iBAgB/E,CAAA"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Detect Changes Action Template
|
|
3
3
|
*
|
|
4
|
-
* Generates a REUSABLE GitHub composite action that detects which domains have changed
|
|
5
|
-
*
|
|
4
|
+
* Generates a REUSABLE GitHub composite action that detects which domains have changed
|
|
5
|
+
* using path-based change detection with dorny/paths-filter.
|
|
6
6
|
*
|
|
7
7
|
* ## Purpose
|
|
8
8
|
*
|
|
9
|
-
* This action is **configuration-driven** and accepts domain definitions as
|
|
10
|
-
* making it truly reusable across any project without regeneration
|
|
11
|
-
*
|
|
12
|
-
* - For path-based projects: Uses path filters to detect which domains changed
|
|
13
|
-
* - Automatically falls back to path-based detection if Nx is unavailable
|
|
9
|
+
* This action is **configuration-driven** and accepts domain definitions as YAML input,
|
|
10
|
+
* making it truly reusable across any project without regeneration.
|
|
11
|
+
* It uses path filters to detect which domains changed based on file glob patterns.
|
|
14
12
|
*
|
|
15
13
|
* ## Key Design Principle
|
|
16
14
|
*
|
|
@@ -26,26 +24,22 @@
|
|
|
26
24
|
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
27
25
|
import fs from 'fs';
|
|
28
26
|
import { logger } from '../../utils/logger.js';
|
|
29
|
-
import { getActionOutputDir } from '../../utils/action-reference.js';
|
|
27
|
+
import { getActionOutputDir, shouldGenerateActions } from '../../utils/action-reference.js';
|
|
30
28
|
/**
|
|
31
29
|
* Generates the detect-changes composite action YAML content.
|
|
32
30
|
*
|
|
33
31
|
* Creates a GitHub Actions composite action that:
|
|
34
|
-
* - Accepts domain configuration as
|
|
35
|
-
* - Dynamically parses domains using
|
|
36
|
-
* -
|
|
37
|
-
* - Uses `nx show projects --affected` for dependency graph analysis
|
|
38
|
-
* - Maps affected projects to domains dynamically
|
|
39
|
-
* - Falls back to path-based detection if Nx isn't available
|
|
32
|
+
* - Accepts domain configuration as YAML input (not hardcoded)
|
|
33
|
+
* - Dynamically parses domains using yq or grep fallback
|
|
34
|
+
* - Uses dorny/paths-filter for path-based change detection
|
|
40
35
|
* - Outputs individual domain results AND a JSON summary
|
|
41
36
|
*
|
|
42
37
|
* @param {any} ctx - Context (not used - action is fully dynamic now)
|
|
43
38
|
* @returns {string} YAML content for the composite action
|
|
44
39
|
*/
|
|
45
40
|
const changesActionTemplate = (ctx) => {
|
|
46
|
-
// Generate the composite action YAML - now fully configuration-driven
|
|
47
41
|
return `name: 'Detect Changes (Configuration-Driven)'
|
|
48
|
-
description: '
|
|
42
|
+
description: 'Path-based change detection using dorny/paths-filter. Accepts domain configuration as YAML input.'
|
|
49
43
|
author: 'Pipecraft'
|
|
50
44
|
|
|
51
45
|
inputs:
|
|
@@ -56,18 +50,6 @@ inputs:
|
|
|
56
50
|
domains-config:
|
|
57
51
|
description: 'YAML string of domain configurations (embedded in pipeline at generation time)'
|
|
58
52
|
required: true
|
|
59
|
-
useNx:
|
|
60
|
-
description: 'Whether to use Nx dependency graph for change detection'
|
|
61
|
-
required: false
|
|
62
|
-
default: 'true'
|
|
63
|
-
node-version:
|
|
64
|
-
description: 'Node.js version to use'
|
|
65
|
-
required: false
|
|
66
|
-
default: '20'
|
|
67
|
-
pnpm-version:
|
|
68
|
-
description: 'pnpm version to use (only used if pnpm detected)'
|
|
69
|
-
required: false
|
|
70
|
-
default: '9'
|
|
71
53
|
|
|
72
54
|
outputs:
|
|
73
55
|
changes:
|
|
@@ -76,12 +58,6 @@ outputs:
|
|
|
76
58
|
affectedDomains:
|
|
77
59
|
description: 'Comma-separated list of domains with changes'
|
|
78
60
|
value: \${{ steps.output.outputs.affectedDomains }}
|
|
79
|
-
nxAvailable:
|
|
80
|
-
description: 'Whether Nx is available in the repository'
|
|
81
|
-
value: \${{ steps.nx-check.outputs.available }}
|
|
82
|
-
affectedProjects:
|
|
83
|
-
description: 'Comma-separated list of affected Nx projects'
|
|
84
|
-
value: \${{ steps.nx-filter.outputs.affectedProjects }}
|
|
85
61
|
|
|
86
62
|
runs:
|
|
87
63
|
using: 'composite'
|
|
@@ -100,7 +76,7 @@ runs:
|
|
|
100
76
|
run: |
|
|
101
77
|
# Parse the domains-config YAML input (embedded in pipeline at generation time)
|
|
102
78
|
echo "\${{ inputs.domains-config }}" > /tmp/domains-config.yml
|
|
103
|
-
|
|
79
|
+
|
|
104
80
|
# Extract domain names using yq (or fallback to grep/awk)
|
|
105
81
|
if command -v yq >/dev/null 2>&1; then
|
|
106
82
|
DOMAIN_NAMES=$(yq eval 'keys | join(",")' /tmp/domains-config.yml)
|
|
@@ -108,150 +84,28 @@ runs:
|
|
|
108
84
|
# Fallback: extract domain names without yq
|
|
109
85
|
DOMAIN_NAMES=$(grep -E '^[[:space:]]*[a-zA-Z0-9_-]+:' /tmp/domains-config.yml | sed 's/[[:space:]]*\\(.*\\):.*/\\1/' | tr '\\n' ',' | sed 's/,$//')
|
|
110
86
|
fi
|
|
111
|
-
|
|
87
|
+
|
|
112
88
|
echo "domains=$DOMAIN_NAMES" >> $GITHUB_OUTPUT
|
|
113
89
|
echo "📋 Configured domains: $DOMAIN_NAMES"
|
|
114
|
-
|
|
115
|
-
# Create filters file for paths-filter action
|
|
116
|
-
echo "filters:" > /tmp/path-filters.yml
|
|
117
|
-
cat /tmp/domains-config.yml >> /tmp/path-filters.yml
|
|
118
|
-
|
|
119
|
-
cat /tmp/path-filters.yml
|
|
120
|
-
echo ""
|
|
121
|
-
|
|
122
|
-
- name: Check for Nx
|
|
123
|
-
id: nx-check
|
|
124
|
-
shell: bash
|
|
125
|
-
run: |
|
|
126
|
-
if [ -f "nx.json" ] || ([ -f "package.json" ] && grep -q '"nx"' package.json); then
|
|
127
|
-
echo "available=true" >> $GITHUB_OUTPUT
|
|
128
|
-
echo "🔍 Nx detected in repository"
|
|
129
|
-
else
|
|
130
|
-
echo "available=false" >> $GITHUB_OUTPUT
|
|
131
|
-
echo "⚠️ Nx not detected, falling back to path-based detection"
|
|
132
|
-
fi
|
|
133
|
-
|
|
134
|
-
- name: Setup Node.js
|
|
135
|
-
if: steps.nx-check.outputs.available == 'true' && inputs.useNx == 'true'
|
|
136
|
-
uses: actions/setup-node@v4
|
|
137
|
-
with:
|
|
138
|
-
node-version: \${{ inputs.node-version }}
|
|
139
|
-
|
|
140
|
-
- name: Install Dependencies
|
|
141
|
-
if: steps.nx-check.outputs.available == 'true' && inputs.useNx == 'true'
|
|
142
|
-
shell: bash
|
|
143
|
-
run: |
|
|
144
|
-
echo "📦 Installing dependencies for Nx..."
|
|
145
|
-
if [ -f "pnpm-lock.yaml" ]; then
|
|
146
|
-
corepack enable
|
|
147
|
-
pnpm install --frozen-lockfile || pnpm install
|
|
148
|
-
elif [ -f "yarn.lock" ]; then
|
|
149
|
-
yarn install --frozen-lockfile || yarn install
|
|
150
|
-
elif [ -f "package-lock.json" ]; then
|
|
151
|
-
npm ci || npm install
|
|
152
|
-
else
|
|
153
|
-
npm install
|
|
154
|
-
fi
|
|
155
|
-
|
|
156
|
-
- name: Detect Changes with Nx (if available)
|
|
157
|
-
id: nx-filter
|
|
158
|
-
if: steps.nx-check.outputs.available == 'true' && inputs.useNx == 'true'
|
|
159
|
-
shell: bash
|
|
160
|
-
run: |
|
|
161
|
-
echo "🚀 Using Nx dependency graph for change detection"
|
|
162
|
-
|
|
163
|
-
# Get affected projects using Nx
|
|
164
|
-
if command -v npx >/dev/null 2>&1; then
|
|
165
|
-
# Get list of affected projects (newline-separated)
|
|
166
|
-
AFFECTED_PROJECTS_RAW=$(npx nx show projects --affected --base=\${{ steps.set-base.outputs.base_branch }} 2>/dev/null || echo "")
|
|
167
|
-
|
|
168
|
-
# Convert newlines to commas for storage
|
|
169
|
-
AFFECTED_PROJECTS=$(echo "$AFFECTED_PROJECTS_RAW" | tr '\\n' ',' | sed 's/,$//')
|
|
170
|
-
echo "affectedProjects=$AFFECTED_PROJECTS" >> $GITHUB_OUTPUT
|
|
171
|
-
|
|
172
|
-
if [ -n "$AFFECTED_PROJECTS" ]; then
|
|
173
|
-
echo "📦 Affected Nx projects: $AFFECTED_PROJECTS"
|
|
174
|
-
|
|
175
|
-
# Parse domains dynamically from config
|
|
176
|
-
IFS=',' read -ra DOMAIN_NAMES <<< "\${{ steps.parse-domains.outputs.domains }}"
|
|
177
|
-
|
|
178
|
-
# Initialize results JSON
|
|
179
|
-
echo "{" > /tmp/nx-results.json
|
|
180
|
-
FIRST=true
|
|
181
|
-
|
|
182
|
-
# Check each domain dynamically
|
|
183
|
-
for domain in "\${DOMAIN_NAMES[@]}"; do
|
|
184
|
-
domain=$(echo "$domain" | xargs) # trim whitespace
|
|
185
|
-
DOMAIN_AFFECTED=false
|
|
186
|
-
|
|
187
|
-
# Check if any affected project matches this domain name
|
|
188
|
-
IFS=',' read -ra PROJECTS <<< "$AFFECTED_PROJECTS"
|
|
189
|
-
for project in "\${PROJECTS[@]}"; do
|
|
190
|
-
project=$(echo "$project" | xargs)
|
|
191
|
-
# Match if project name contains domain name (with flexible - vs _ matching)
|
|
192
|
-
domain_pattern=$(echo "$domain" | sed 's/-/[-_]/g')
|
|
193
|
-
if echo "$project" | grep -qiE "$domain_pattern"; then
|
|
194
|
-
DOMAIN_AFFECTED=true
|
|
195
|
-
echo " ✅ $project matches $domain domain"
|
|
196
|
-
break
|
|
197
|
-
fi
|
|
198
|
-
done
|
|
199
|
-
|
|
200
|
-
# Add to JSON
|
|
201
|
-
if [ "$FIRST" = true ]; then
|
|
202
|
-
FIRST=false
|
|
203
|
-
else
|
|
204
|
-
echo "," >> /tmp/nx-results.json
|
|
205
|
-
fi
|
|
206
|
-
echo " \\"$domain\\": $DOMAIN_AFFECTED" >> /tmp/nx-results.json
|
|
207
|
-
done
|
|
208
|
-
|
|
209
|
-
echo "}" >> /tmp/nx-results.json
|
|
210
|
-
|
|
211
|
-
else
|
|
212
|
-
echo "No affected projects detected"
|
|
213
|
-
# Create empty results
|
|
214
|
-
echo "{}" > /tmp/nx-results.json
|
|
215
|
-
IFS=',' read -ra DOMAIN_NAMES <<< "\${{ steps.parse-domains.outputs.domains }}"
|
|
216
|
-
FIRST=true
|
|
217
|
-
for domain in "\${DOMAIN_NAMES[@]}"; do
|
|
218
|
-
if [ "$FIRST" = true ]; then
|
|
219
|
-
echo "{" > /tmp/nx-results.json
|
|
220
|
-
FIRST=false
|
|
221
|
-
else
|
|
222
|
-
echo "," >> /tmp/nx-results.json
|
|
223
|
-
fi
|
|
224
|
-
echo " \\"$domain\\": false" >> /tmp/nx-results.json
|
|
225
|
-
done
|
|
226
|
-
echo "}" >> /tmp/nx-results.json
|
|
227
|
-
fi
|
|
228
|
-
else
|
|
229
|
-
echo "⚠️ npx not available, falling back to path-based detection"
|
|
230
|
-
echo "{}" > /tmp/nx-results.json
|
|
231
|
-
echo "affectedProjects=" >> $GITHUB_OUTPUT
|
|
232
|
-
fi
|
|
233
|
-
|
|
234
|
-
cat /tmp/nx-results.json
|
|
235
90
|
|
|
236
91
|
- name: Transform Domain Config for Paths Filter
|
|
237
92
|
id: transform-config
|
|
238
|
-
if: steps.nx-check.outputs.available != 'true' || inputs.useNx != 'true'
|
|
239
93
|
shell: bash
|
|
240
94
|
run: |
|
|
241
95
|
# Transform domains-config from PipeCraft format to paths-filter format
|
|
242
96
|
# PipeCraft format: domain: { paths: [...] }
|
|
243
97
|
# paths-filter format: domain: [...]
|
|
244
|
-
|
|
98
|
+
|
|
245
99
|
# Read the domains config
|
|
246
100
|
cat /tmp/domains-config.yml
|
|
247
|
-
|
|
101
|
+
|
|
248
102
|
# Transform: remove 'paths:' lines and unindent the glob patterns
|
|
249
103
|
sed '/paths:/d' /tmp/domains-config.yml | sed 's/^ -/-/' > /tmp/paths-filter-config.yml
|
|
250
|
-
|
|
104
|
+
|
|
251
105
|
echo ""
|
|
252
106
|
echo "Transformed for paths-filter:"
|
|
253
107
|
cat /tmp/paths-filter-config.yml
|
|
254
|
-
|
|
108
|
+
|
|
255
109
|
# Store as output for use in paths-filter
|
|
256
110
|
{
|
|
257
111
|
echo "filters<<EOF"
|
|
@@ -259,10 +113,9 @@ runs:
|
|
|
259
113
|
echo "EOF"
|
|
260
114
|
} >> $GITHUB_OUTPUT
|
|
261
115
|
|
|
262
|
-
- name: Detect Changes with Paths Filter
|
|
116
|
+
- name: Detect Changes with Paths Filter
|
|
263
117
|
uses: dorny/paths-filter@v3
|
|
264
118
|
id: filter
|
|
265
|
-
if: steps.nx-check.outputs.available != 'true' || inputs.useNx != 'true'
|
|
266
119
|
with:
|
|
267
120
|
base: \${{ steps.set-base.outputs.base_branch }}
|
|
268
121
|
filters: \${{ steps.transform-config.outputs.filters }}
|
|
@@ -271,78 +124,72 @@ runs:
|
|
|
271
124
|
id: output
|
|
272
125
|
shell: bash
|
|
273
126
|
run: |
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
else
|
|
299
|
-
echo " \\"$domain\\": false" >> /tmp/path-results.json
|
|
300
|
-
fi
|
|
301
|
-
done
|
|
302
|
-
echo "}" >> /tmp/path-results.json
|
|
303
|
-
|
|
304
|
-
CHANGES_JSON=$(cat /tmp/path-results.json)
|
|
305
|
-
fi
|
|
306
|
-
|
|
127
|
+
echo "📁 Using path-based change detection"
|
|
128
|
+
echo "{" > /tmp/path-results.json
|
|
129
|
+
|
|
130
|
+
IFS=',' read -ra DOMAIN_NAMES <<< "\${{ steps.parse-domains.outputs.domains }}"
|
|
131
|
+
FIRST=true
|
|
132
|
+
for domain in "\${DOMAIN_NAMES[@]}"; do
|
|
133
|
+
domain=$(echo "$domain" | xargs)
|
|
134
|
+
if [ "$FIRST" = true ]; then
|
|
135
|
+
FIRST=false
|
|
136
|
+
else
|
|
137
|
+
echo "," >> /tmp/path-results.json
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
# Check if domain appears in filter changes
|
|
141
|
+
if echo "\${{ steps.filter.outputs.changes }}" | grep -q "$domain"; then
|
|
142
|
+
echo " \\"$domain\\": true" >> /tmp/path-results.json
|
|
143
|
+
else
|
|
144
|
+
echo " \\"$domain\\": false" >> /tmp/path-results.json
|
|
145
|
+
fi
|
|
146
|
+
done
|
|
147
|
+
echo "}" >> /tmp/path-results.json
|
|
148
|
+
|
|
149
|
+
CHANGES_JSON=$(cat /tmp/path-results.json)
|
|
150
|
+
|
|
307
151
|
# Output the JSON
|
|
308
152
|
echo "changes<<EOF" >> $GITHUB_OUTPUT
|
|
309
153
|
echo "$CHANGES_JSON" >> $GITHUB_OUTPUT
|
|
310
154
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
311
|
-
|
|
312
|
-
# Build comma-separated list of affected domains
|
|
313
|
-
AFFECTED_DOMAINS=$(
|
|
155
|
+
|
|
156
|
+
# Build comma-separated list of affected domains (using node instead of jq for portability)
|
|
157
|
+
AFFECTED_DOMAINS=$(node -e "
|
|
158
|
+
const data = JSON.parse(process.argv[1]);
|
|
159
|
+
const affected = Object.entries(data)
|
|
160
|
+
.filter(([_, v]) => v === true)
|
|
161
|
+
.map(([k]) => k)
|
|
162
|
+
.join(',');
|
|
163
|
+
console.log(affected);
|
|
164
|
+
" "$CHANGES_JSON")
|
|
314
165
|
echo "affectedDomains=$AFFECTED_DOMAINS" >> $GITHUB_OUTPUT
|
|
315
|
-
|
|
166
|
+
|
|
316
167
|
echo "📋 Change Detection Results:"
|
|
317
|
-
|
|
168
|
+
node -e "console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 2))" "$CHANGES_JSON"
|
|
318
169
|
echo "🎯 Affected domains: $AFFECTED_DOMAINS"
|
|
319
|
-
echo " nx-available: \${{ steps.nx-check.outputs.available }}"
|
|
320
170
|
`;
|
|
321
171
|
};
|
|
322
172
|
/**
|
|
323
173
|
* Generator entry point for detect-changes composite action.
|
|
324
174
|
*
|
|
325
|
-
* Generates the
|
|
175
|
+
* Generates the \`actions/detect-changes/action.yml\` file with configuration-driven
|
|
326
176
|
* change detection logic. This action accepts domain configuration as input at runtime,
|
|
327
177
|
* making it truly reusable without regeneration.
|
|
328
178
|
*
|
|
329
|
-
*
|
|
330
|
-
* them as JSON input from the workflow, allowing the same action to work with any
|
|
331
|
-
* domain configuration.
|
|
332
|
-
*
|
|
333
|
-
* @param {PinionContext} ctx - Pinion generator context (domains no longer needed in template)
|
|
179
|
+
* @param {PinionContext} ctx - Pinion generator context
|
|
334
180
|
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
335
181
|
*/
|
|
336
|
-
export const generate = (ctx) => Promise.resolve(ctx)
|
|
337
|
-
.then(ctx => {
|
|
338
|
-
// Determine output directory based on actionSourceMode
|
|
182
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(ctx => {
|
|
339
183
|
const config = ctx.config || {};
|
|
184
|
+
if (!shouldGenerateActions(config)) {
|
|
185
|
+
logger.verbose('Skipping detect-changes action generation (using remote actions)');
|
|
186
|
+
return ctx;
|
|
187
|
+
}
|
|
340
188
|
const outputDir = getActionOutputDir(config);
|
|
341
189
|
const filePath = `${outputDir}/detect-changes/action.yml`;
|
|
342
190
|
const exists = fs.existsSync(filePath);
|
|
343
191
|
const status = exists ? '🔄 Merged with existing' : '📝 Created new';
|
|
344
192
|
logger.verbose(`${status} ${filePath}`);
|
|
345
|
-
return
|
|
346
|
-
})
|
|
347
|
-
.then(ctx => renderTemplate(changesActionTemplate, toFile(ctx.actionOutputPath || 'actions/detect-changes/action.yml'))(ctx));
|
|
193
|
+
return renderTemplate(changesActionTemplate, toFile(filePath))(ctx);
|
|
194
|
+
});
|
|
348
195
|
//# sourceMappingURL=detect-changes.yml.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-changes.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/detect-changes.yml.tpl.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"detect-changes.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/detect-changes.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAG3F;;;;;;;;;;;GAWG;AACH,MAAM,qBAAqB,GAAG,CAAC,GAAQ,EAAE,EAAE;IACzC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiIR,CAAA;AACD,CAAC,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA0D,EAAE,EAAE,CACrF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;IAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAA;IAE/B,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,kEAAkE,CAAC,CAAA;QAClF,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,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;IAEvC,OAAO,cAAc,CAAC,qBAAqB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACrE,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manage-branch.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/manage-branch.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAKlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AA4H3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"manage-branch.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/manage-branch.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAKlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AA4H3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,iBAgB/E,CAAA"}
|
|
@@ -10,7 +10,7 @@ import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
|
10
10
|
import dedent from 'dedent';
|
|
11
11
|
import fs from 'fs';
|
|
12
12
|
import { logger } from '../../utils/logger.js';
|
|
13
|
-
import { getActionOutputDir } from '../../utils/action-reference.js';
|
|
13
|
+
import { getActionOutputDir, shouldGenerateActions } from '../../utils/action-reference.js';
|
|
14
14
|
/**
|
|
15
15
|
* Generates the manage-branch composite action YAML content.
|
|
16
16
|
*
|
|
@@ -138,16 +138,17 @@ const branchActionTemplate = (ctx) => {
|
|
|
138
138
|
* @param {PinionContext} ctx - Pinion generator context
|
|
139
139
|
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
140
140
|
*/
|
|
141
|
-
export const generate = (ctx) => Promise.resolve(ctx)
|
|
142
|
-
.then(ctx => {
|
|
143
|
-
// Check if file exists to determine merge status
|
|
141
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(ctx => {
|
|
144
142
|
const config = ctx.config || {};
|
|
143
|
+
if (!shouldGenerateActions(config)) {
|
|
144
|
+
logger.verbose('Skipping manage-branch action generation (using remote actions)');
|
|
145
|
+
return ctx;
|
|
146
|
+
}
|
|
145
147
|
const outputDir = getActionOutputDir(config);
|
|
146
148
|
const filePath = `${outputDir}/manage-branch/action.yml`;
|
|
147
149
|
const exists = fs.existsSync(filePath);
|
|
148
150
|
const status = exists ? '🔄 Merged with existing' : '📝 Created new';
|
|
149
151
|
logger.verbose(`${status} ${filePath}`);
|
|
150
|
-
return
|
|
151
|
-
})
|
|
152
|
-
.then(ctx => renderTemplate(branchActionTemplate, toFile(ctx.actionOutputPath || 'actions/manage-branch/action.yml'))(ctx));
|
|
152
|
+
return renderTemplate(branchActionTemplate, toFile(filePath))(ctx);
|
|
153
|
+
});
|
|
153
154
|
//# sourceMappingURL=manage-branch.yml.tpl.js.map
|