pipecraft 0.0.0-releaseit โ 0.26.0
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 +126 -108
- package/dist/cli/index.d.ts +69 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +94 -22
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/init.tpl.d.ts +70 -0
- package/dist/generators/init.tpl.d.ts.map +1 -1
- package/dist/generators/init.tpl.js +100 -8
- package/dist/generators/init.tpl.js.map +1 -1
- package/dist/generators/workflows.tpl.d.ts +86 -0
- package/dist/generators/workflows.tpl.d.ts.map +1 -1
- package/dist/generators/workflows.tpl.js +101 -9
- package/dist/generators/workflows.tpl.js.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts +47 -0
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.js +72 -3
- package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.d.ts +14 -0
- package/dist/templates/actions/create-pr.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.js +22 -2
- package/dist/templates/actions/create-pr.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-release.yml.tpl.d.ts +18 -0
- package/dist/templates/actions/create-release.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/create-release.yml.tpl.js +141 -0
- package/dist/templates/actions/create-release.yml.tpl.js.map +1 -0
- package/dist/templates/actions/create-tag.yml.tpl.d.ts +14 -0
- package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.js +22 -2
- package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts +70 -0
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.js +98 -2
- package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts +14 -0
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.js +22 -2
- package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts +14 -0
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.js +50 -7
- package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts +114 -1
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +479 -74
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +1 -1
- package/dist/types/index.d.ts +231 -8
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/ast-path-operations.d.ts.map +1 -1
- package/dist/utils/ast-path-operations.js +24 -11
- package/dist/utils/ast-path-operations.js.map +1 -1
- package/dist/utils/config.d.ts +63 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +71 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/github-setup.d.ts +323 -2
- package/dist/utils/github-setup.d.ts.map +1 -1
- package/dist/utils/github-setup.js +551 -23
- package/dist/utils/github-setup.js.map +1 -1
- package/dist/utils/idempotency.d.ts +147 -7
- package/dist/utils/idempotency.d.ts.map +1 -1
- package/dist/utils/idempotency.js +143 -15
- package/dist/utils/idempotency.js.map +1 -1
- package/dist/utils/logger.d.ts +134 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +153 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/preflight.d.ts +223 -12
- package/dist/utils/preflight.d.ts.map +1 -1
- package/dist/utils/preflight.js +216 -16
- package/dist/utils/preflight.js.map +1 -1
- package/dist/utils/versioning.d.ts +160 -8
- package/dist/utils/versioning.d.ts.map +1 -1
- package/dist/utils/versioning.js +179 -15
- package/dist/utils/versioning.js.map +1 -1
- package/package.json +26 -5
- package/.claude/settings.local.json +0 -35
- package/.github/actions/calculate-version/action.yml +0 -106
- package/.github/actions/create-pr/action.yml +0 -122
- package/.github/actions/create-release/action.yml +0 -74
- package/.github/actions/create-tag/action.yml +0 -94
- package/.github/actions/detect-changes/action.yml +0 -62
- package/.github/actions/manage-branch/action.yml +0 -113
- package/.github/actions/promote-branch/action.yml +0 -352
- package/.github/example/workflows/job.analyze.code.yml +0 -26
- package/.github/example/workflows/job.analyze.docker.yml +0 -32
- package/.github/example/workflows/job.app.api.deploy.yml +0 -127
- package/.github/example/workflows/job.app.api.test.yml +0 -102
- package/.github/example/workflows/job.app.docs.deploy.yml +0 -40
- package/.github/example/workflows/job.app.docs.test.yml +0 -50
- package/.github/example/workflows/job.app.web.deploy.yml +0 -96
- package/.github/example/workflows/job.app.web.test.yml +0 -49
- package/.github/example/workflows/job.changes.yml +0 -82
- package/.github/example/workflows/job.create-pr.yml +0 -96
- package/.github/example/workflows/job.env-check.yml +0 -43
- package/.github/example/workflows/job.fast-forward.yml +0 -103
- package/.github/example/workflows/job.lint.yml +0 -64
- package/.github/example/workflows/job.pr-name.yml +0 -70
- package/.github/example/workflows/job.pr-squash-name.yml +0 -27
- package/.github/example/workflows/job.tag.yml +0 -38
- package/.github/example/workflows/job.version.yml +0 -99
- package/.github/example/workflows/lib.plugin-base.publish.yml +0 -59
- package/.github/example/workflows/pipe.yml +0 -178
- package/.github/example/workflows/scripts/fastforward.sh +0 -51
- package/.github/example/workflows/scripts/pipe-cleaner.sh +0 -70
- package/.github/scripts/fastforward.sh +0 -51
- package/.github/scripts/pipe-cleaner.sh +0 -70
- package/.github/workflows/pipeline.yml +0 -220
- package/.github/workflows/pr-title-check.yml +0 -70
- package/.github/workflows/publish.yml +0 -39
- package/.pipecraftrc.json +0 -78
- package/.release-it.cjs +0 -71
- package/PIPELINE_TESTING_PLAN.md +0 -499
- package/TRUNK_FLOW_PLAN.md +0 -401
- package/assets/logo_banner.png +0 -0
- package/assets/logo_banner.webp +0 -0
- package/docs/USER_JOURNEY_ERRORS.md +0 -352
- package/eslint.config.js +0 -77
- package/examples/basic-config.json +0 -41
- package/examples/monorepo-config.json +0 -49
- package/examples/usage.md +0 -289
- package/scripts/debug-workflows.sh +0 -339
- package/scripts/parse-pipeline.js +0 -29
- package/scripts/test-job-order.cjs +0 -140
- package/scripts/validate-pipeline.cjs +0 -379
- package/scripts/verify-job-order.sh +0 -30
- package/src/cli/index.ts +0 -414
- package/src/generators/init.tpl.ts +0 -126
- package/src/generators/workflows.tpl.ts +0 -80
- package/src/templates/actions/calculate-version.yml.tpl.ts +0 -124
- package/src/templates/actions/create-pr.yml.tpl.ts +0 -147
- package/src/templates/actions/create-tag.yml.tpl.ts +0 -112
- package/src/templates/actions/detect-changes.yml.tpl.ts +0 -87
- package/src/templates/actions/manage-branch.yml.tpl.ts +0 -132
- package/src/templates/actions/promote-branch.yml.tpl.ts +0 -364
- package/src/templates/workflows/pipeline-path-based.yml.tpl.ts +0 -706
- package/src/types/index.ts +0 -64
- package/src/utils/README-ast-path-operations.md +0 -390
- package/src/utils/ast-path-operations.ts +0 -581
- package/src/utils/config.ts +0 -64
- package/src/utils/github-setup.ts +0 -558
- package/src/utils/idempotency.ts +0 -215
- package/src/utils/preflight.ts +0 -306
- package/src/utils/versioning.ts +0 -244
- package/tests/README.md +0 -229
- package/tests/TEST_STRUCTURE.md +0 -256
- package/tests/act/run-act-tests.sh +0 -345
- package/tests/debugging/debug-utils.ts +0 -538
- package/tests/debugging/debug-workflow.test.ts +0 -339
- package/tests/debugging/debug-workflows.sh +0 -339
- package/tests/debugging/iterative-debug.ts +0 -652
- package/tests/debugging/run-debug-tests.sh +0 -431
- package/tests/fixtures/basic-config.json +0 -51
- package/tests/fixtures/invalid-config.json +0 -9
- package/tests/fixtures/pipeline-generated.yml +0 -235
- package/tests/fixtures/pipeline-preserve-comments.yml +0 -245
- package/tests/fixtures/pipeline-user-modified.yml +0 -245
- package/tests/fixtures/test-config.json +0 -58
- package/tests/github-live/README.md +0 -250
- package/tests/github-local/JOB_WORKFLOW_TESTS.md +0 -296
- package/tests/github-local/README.md +0 -240
- package/tests/github-local/run-all-tests.sh +0 -422
- package/tests/github-local/test-job-workflows.sh +0 -631
- package/tests/github-local/test-pipeline-workflow.sh +0 -440
- package/tests/integration/generators.test.ts +0 -578
- package/tests/integration/path-based-template.test.ts +0 -510
- package/tests/integration/simple-path-based.test.ts +0 -415
- package/tests/setup.ts +0 -56
- package/tests/unit/ast-path-operations-extended.test.ts +0 -302
- package/tests/unit/cli.test.ts +0 -541
- package/tests/unit/config-extended.test.ts +0 -412
- package/tests/unit/config.test.ts +0 -152
- package/tests/unit/github-setup.test.ts +0 -189
- package/tests/unit/idempotency-isolated.test.ts +0 -297
- package/tests/unit/job-order.test.ts +0 -157
- package/tests/unit/pipeline-path-based.test.ts +0 -511
- package/tests/unit/validate-pipeline.test.ts +0 -384
- package/tests/unit/versioning-extended.test.ts +0 -279
- package/tests/unit/versioning.test.ts +0 -241
- package/tsconfig.debug.json +0 -17
- package/tsconfig.json +0 -28
- package/vitest.config.ts +0 -51
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
name: 'Create Release'
|
|
2
|
-
description: 'Create a GitHub release with auto-generated release notes'
|
|
3
|
-
author: 'PipeCraft'
|
|
4
|
-
|
|
5
|
-
inputs:
|
|
6
|
-
version:
|
|
7
|
-
description: 'Version to release (e.g., v1.2.3)'
|
|
8
|
-
required: true
|
|
9
|
-
token:
|
|
10
|
-
description: 'GitHub token for authentication'
|
|
11
|
-
required: false
|
|
12
|
-
default: ${{ github.token }}
|
|
13
|
-
|
|
14
|
-
outputs:
|
|
15
|
-
release_url:
|
|
16
|
-
description: 'The URL of the created release'
|
|
17
|
-
value: ${{ steps.create.outputs.release_url }}
|
|
18
|
-
release_id:
|
|
19
|
-
description: 'The ID of the created release'
|
|
20
|
-
value: ${{ steps.create.outputs.release_id }}
|
|
21
|
-
|
|
22
|
-
runs:
|
|
23
|
-
using: 'composite'
|
|
24
|
-
steps:
|
|
25
|
-
- name: Checkout Code
|
|
26
|
-
uses: actions/checkout@v4
|
|
27
|
-
with:
|
|
28
|
-
fetch-depth: 0
|
|
29
|
-
token: ${{ inputs.token }}
|
|
30
|
-
|
|
31
|
-
- name: Create GitHub Release
|
|
32
|
-
id: create
|
|
33
|
-
shell: bash
|
|
34
|
-
env:
|
|
35
|
-
GH_TOKEN: ${{ inputs.token }}
|
|
36
|
-
run: |
|
|
37
|
-
VERSION="${{ inputs.version }}"
|
|
38
|
-
echo "๐ฆ Creating GitHub release for $VERSION"
|
|
39
|
-
|
|
40
|
-
# Generate release notes from commits since last tag
|
|
41
|
-
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
|
42
|
-
|
|
43
|
-
if [ -n "$PREVIOUS_TAG" ]; then
|
|
44
|
-
echo "๐ Generating release notes from $PREVIOUS_TAG to HEAD"
|
|
45
|
-
RELEASE_NOTES=$(git log $PREVIOUS_TAG..HEAD --pretty=format:"- %s" --no-merges)
|
|
46
|
-
else
|
|
47
|
-
echo "๐ Generating release notes from all commits"
|
|
48
|
-
RELEASE_NOTES=$(git log --pretty=format:"- %s" --no-merges)
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
# Create release with notes
|
|
52
|
-
RELEASE_OUTPUT=$(gh release create "$VERSION" \
|
|
53
|
-
--title "Release $VERSION" \
|
|
54
|
-
--notes "$RELEASE_NOTES" \
|
|
55
|
-
--latest 2>&1)
|
|
56
|
-
|
|
57
|
-
RELEASE_EXIT_CODE=$?
|
|
58
|
-
|
|
59
|
-
if [ $RELEASE_EXIT_CODE -eq 0 ]; then
|
|
60
|
-
# Extract release URL from output
|
|
61
|
-
RELEASE_URL=$(echo "$RELEASE_OUTPUT" | grep -oE 'https://github.com/.*/releases/.*')
|
|
62
|
-
echo "release_url=$RELEASE_URL" >> $GITHUB_OUTPUT
|
|
63
|
-
|
|
64
|
-
# Get release ID using gh api
|
|
65
|
-
RELEASE_ID=$(gh api repos/${{ github.repository }}/releases/tags/$VERSION --jq '.id')
|
|
66
|
-
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
|
67
|
-
|
|
68
|
-
echo "โ
Release created successfully"
|
|
69
|
-
echo "๐ URL: $RELEASE_URL"
|
|
70
|
-
else
|
|
71
|
-
echo "โ Failed to create release"
|
|
72
|
-
echo "$RELEASE_OUTPUT"
|
|
73
|
-
exit 1
|
|
74
|
-
fi
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
name: 'Tag Version'
|
|
2
|
-
description: 'Create and push a Git tag for a given version'
|
|
3
|
-
author: 'Pipecraft'
|
|
4
|
-
|
|
5
|
-
inputs:
|
|
6
|
-
version:
|
|
7
|
-
description: 'Version to tag'
|
|
8
|
-
required: true
|
|
9
|
-
tag_prefix:
|
|
10
|
-
description: 'Prefix for the tag (e.g., v)'
|
|
11
|
-
required: false
|
|
12
|
-
default: 'v'
|
|
13
|
-
push:
|
|
14
|
-
description: 'Whether to push the tag to remote'
|
|
15
|
-
required: false
|
|
16
|
-
default: 'true'
|
|
17
|
-
|
|
18
|
-
outputs:
|
|
19
|
-
tag_name:
|
|
20
|
-
description: 'The created tag name'
|
|
21
|
-
value: ${{ steps.tag.outputs.tag_name }}
|
|
22
|
-
success:
|
|
23
|
-
description: 'Whether the tag was created successfully'
|
|
24
|
-
value: ${{ steps.tag.outputs.success }}
|
|
25
|
-
|
|
26
|
-
runs:
|
|
27
|
-
using: 'composite'
|
|
28
|
-
steps:
|
|
29
|
-
- name: Validate Inputs
|
|
30
|
-
id: validate
|
|
31
|
-
shell: bash
|
|
32
|
-
run: |
|
|
33
|
-
if [ -z "${{ inputs.version }}" ]; then
|
|
34
|
-
echo "โ Version is required"
|
|
35
|
-
exit 1
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Strip v prefix if present and validate version format
|
|
39
|
-
VERSION="${{ inputs.version }}"
|
|
40
|
-
VERSION="${VERSION#v}" # Remove v prefix
|
|
41
|
-
|
|
42
|
-
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
43
|
-
echo "โ Version must be in format [v]x.y.z (e.g., 1.0.0 or v1.0.0)"
|
|
44
|
-
exit 1
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
echo "โ
Version format is valid: $VERSION"
|
|
48
|
-
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
49
|
-
|
|
50
|
-
- name: Configure Git
|
|
51
|
-
shell: bash
|
|
52
|
-
run: |
|
|
53
|
-
git config user.name "github-actions[bot]"
|
|
54
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
55
|
-
|
|
56
|
-
- name: Create Tag
|
|
57
|
-
id: tag
|
|
58
|
-
shell: bash
|
|
59
|
-
run: |
|
|
60
|
-
VERSION="${{ steps.validate.outputs.version }}"
|
|
61
|
-
PREFIX="${{ inputs.tag_prefix }}"
|
|
62
|
-
TAG_NAME="${PREFIX}${VERSION}"
|
|
63
|
-
|
|
64
|
-
# Check if tag already exists
|
|
65
|
-
if git tag -l | grep -q "^${TAG_NAME}$"; then
|
|
66
|
-
echo "โ ๏ธ Tag ${TAG_NAME} already exists"
|
|
67
|
-
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
|
|
68
|
-
echo "success=false" >> $GITHUB_OUTPUT
|
|
69
|
-
exit 0
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
# Create the tag
|
|
73
|
-
git tag -a "${TAG_NAME}" -m "Release ${TAG_NAME}"
|
|
74
|
-
echo "โ
Created tag: ${TAG_NAME}"
|
|
75
|
-
|
|
76
|
-
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
|
|
77
|
-
echo "success=true" >> $GITHUB_OUTPUT
|
|
78
|
-
|
|
79
|
-
- name: Push Tag
|
|
80
|
-
if: steps.tag.outputs.success == 'true' && inputs.push == 'true'
|
|
81
|
-
shell: bash
|
|
82
|
-
run: |
|
|
83
|
-
TAG_NAME="${{ steps.tag.outputs.tag_name }}"
|
|
84
|
-
git push origin "${TAG_NAME}"
|
|
85
|
-
echo "โ
Pushed tag ${TAG_NAME} to remote"
|
|
86
|
-
|
|
87
|
-
- name: Action Summary
|
|
88
|
-
shell: bash
|
|
89
|
-
run: |
|
|
90
|
-
if [ "${{ steps.tag.outputs.success }}" == "true" ]; then
|
|
91
|
-
echo "โ
Successfully created and pushed tag: ${{ steps.tag.outputs.tag_name }}"
|
|
92
|
-
else
|
|
93
|
-
echo "โ Failed to create tag: ${{ steps.tag.outputs.tag_name }}"
|
|
94
|
-
fi
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
name: 'Detect Changes'
|
|
2
|
-
description: 'Detect changes in different application domains based on file paths'
|
|
3
|
-
author: 'Pipecraft'
|
|
4
|
-
|
|
5
|
-
inputs:
|
|
6
|
-
baseRef:
|
|
7
|
-
description: 'Base reference to compare against'
|
|
8
|
-
required: false
|
|
9
|
-
default: 'main'
|
|
10
|
-
|
|
11
|
-
outputs:
|
|
12
|
-
core:
|
|
13
|
-
description: 'Whether core domain has changes'
|
|
14
|
-
value: ${{ steps.merge.outputs.core }}
|
|
15
|
-
test:
|
|
16
|
-
description: 'Whether test domain has changes'
|
|
17
|
-
value: ${{ steps.merge.outputs.test }}
|
|
18
|
-
cicd:
|
|
19
|
-
description: 'Whether cicd domain has changes'
|
|
20
|
-
value: ${{ steps.merge.outputs.cicd }}
|
|
21
|
-
|
|
22
|
-
runs:
|
|
23
|
-
using: 'composite'
|
|
24
|
-
steps:
|
|
25
|
-
- name: Checkout Code
|
|
26
|
-
uses: actions/checkout@v4
|
|
27
|
-
with:
|
|
28
|
-
fetch-depth: 0
|
|
29
|
-
|
|
30
|
-
- name: Set Base Branch
|
|
31
|
-
id: set-base
|
|
32
|
-
shell: bash
|
|
33
|
-
run: |
|
|
34
|
-
base_branch=${{ inputs.baseRef || 'main' }}
|
|
35
|
-
echo "base_branch=$base_branch" >> $GITHUB_OUTPUT
|
|
36
|
-
echo "base_branch=$base_branch" >> $GITHUB_ENV
|
|
37
|
-
|
|
38
|
-
- name: Detect Changes
|
|
39
|
-
uses: dorny/paths-filter@v3
|
|
40
|
-
id: filter
|
|
41
|
-
with:
|
|
42
|
-
base: ${{ steps.set-base.outputs.base_branch }}
|
|
43
|
-
filters: |
|
|
44
|
-
core:
|
|
45
|
-
- 'src/**'
|
|
46
|
-
test:
|
|
47
|
-
- 'tests/**'
|
|
48
|
-
cicd:
|
|
49
|
-
- '.github/**'
|
|
50
|
-
|
|
51
|
-
- name: Merge filter outputs
|
|
52
|
-
id: merge
|
|
53
|
-
shell: bash
|
|
54
|
-
run: |
|
|
55
|
-
echo "core=${{ contains(steps.filter.outputs.changes, 'core') }}" >> $GITHUB_OUTPUT
|
|
56
|
-
echo "test=${{ contains(steps.filter.outputs.changes, 'test') }}" >> $GITHUB_OUTPUT
|
|
57
|
-
echo "cicd=${{ contains(steps.filter.outputs.changes, 'cicd') }}" >> $GITHUB_OUTPUT
|
|
58
|
-
|
|
59
|
-
echo "๐ Change Detection Results:"
|
|
60
|
-
echo " core: ${{ contains(steps.filter.outputs.changes, 'core') }}"
|
|
61
|
-
echo " test: ${{ contains(steps.filter.outputs.changes, 'test') }}"
|
|
62
|
-
echo " cicd: ${{ contains(steps.filter.outputs.changes, 'cicd') }}"
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
name: 'Branch Management'
|
|
2
|
-
description: 'Manage branches (fast-forward, create, delete)'
|
|
3
|
-
author: 'Pipecraft'
|
|
4
|
-
|
|
5
|
-
inputs:
|
|
6
|
-
action:
|
|
7
|
-
description: 'Action to perform (fast-forward, create, delete)'
|
|
8
|
-
required: true
|
|
9
|
-
targetBranch:
|
|
10
|
-
description: 'Target branch for the action'
|
|
11
|
-
required: true
|
|
12
|
-
sourceBranch:
|
|
13
|
-
description: 'Source branch for the action'
|
|
14
|
-
required: false
|
|
15
|
-
branchName:
|
|
16
|
-
description: 'Name for new branch (for create action)'
|
|
17
|
-
required: false
|
|
18
|
-
|
|
19
|
-
outputs:
|
|
20
|
-
success:
|
|
21
|
-
description: 'Whether the action was successful'
|
|
22
|
-
value: ${{ steps.branch-action.outputs.success }}
|
|
23
|
-
message:
|
|
24
|
-
description: 'Result message'
|
|
25
|
-
value: ${{ steps.branch-action.outputs.message }}
|
|
26
|
-
|
|
27
|
-
runs:
|
|
28
|
-
using: 'composite'
|
|
29
|
-
steps:
|
|
30
|
-
- name: Checkout Code
|
|
31
|
-
uses: actions/checkout@v4
|
|
32
|
-
with:
|
|
33
|
-
fetch-depth: 0
|
|
34
|
-
token: ${{ inputs.token }}
|
|
35
|
-
|
|
36
|
-
- name: Validate Inputs
|
|
37
|
-
id: validate
|
|
38
|
-
shell: bash
|
|
39
|
-
run: |
|
|
40
|
-
ACTION="${{ inputs.action }}"
|
|
41
|
-
TARGET="${{ inputs.targetBranch }}"
|
|
42
|
-
SOURCE="${{ inputs.sourceBranch }}"
|
|
43
|
-
BRANCH_NAME="${{ inputs.branchName }}"
|
|
44
|
-
|
|
45
|
-
case "$ACTION" in
|
|
46
|
-
"fast-forward")
|
|
47
|
-
if [ -z "$SOURCE" ]; then
|
|
48
|
-
echo "โ Source branch is required for fast-forward"
|
|
49
|
-
exit 1
|
|
50
|
-
fi
|
|
51
|
-
;;
|
|
52
|
-
"create")
|
|
53
|
-
if [ -z "$BRANCH_NAME" ]; then
|
|
54
|
-
echo "โ Branch name is required for create action"
|
|
55
|
-
exit 1
|
|
56
|
-
fi
|
|
57
|
-
;;
|
|
58
|
-
"delete")
|
|
59
|
-
if [ -z "$TARGET" ]; then
|
|
60
|
-
echo "โ Target branch is required for delete action"
|
|
61
|
-
exit 1
|
|
62
|
-
fi
|
|
63
|
-
;;
|
|
64
|
-
*)
|
|
65
|
-
echo "โ Invalid action: $ACTION. Must be fast-forward, create, or delete"
|
|
66
|
-
exit 1
|
|
67
|
-
;;
|
|
68
|
-
esac
|
|
69
|
-
|
|
70
|
-
echo "โ
Input validation passed"
|
|
71
|
-
|
|
72
|
-
- name: Perform Branch Action
|
|
73
|
-
id: branch-action
|
|
74
|
-
shell: bash
|
|
75
|
-
run: |
|
|
76
|
-
ACTION="${{ inputs.action }}"
|
|
77
|
-
TARGET="${{ inputs.targetBranch }}"
|
|
78
|
-
SOURCE="${{ inputs.sourceBranch }}"
|
|
79
|
-
BRANCH_NAME="${{ inputs.branchName }}"
|
|
80
|
-
|
|
81
|
-
case "$ACTION" in
|
|
82
|
-
"fast-forward")
|
|
83
|
-
echo "๐ Fast-forwarding $TARGET to $SOURCE"
|
|
84
|
-
git checkout "$TARGET"
|
|
85
|
-
git merge --ff-only "$SOURCE"
|
|
86
|
-
git push origin "$TARGET"
|
|
87
|
-
echo "success=true" >> $GITHUB_OUTPUT
|
|
88
|
-
echo "message=Successfully fast-forwarded $TARGET to $SOURCE" >> $GITHUB_OUTPUT
|
|
89
|
-
;;
|
|
90
|
-
"create")
|
|
91
|
-
echo "๐ฑ Creating branch $BRANCH_NAME from $TARGET"
|
|
92
|
-
git checkout "$TARGET"
|
|
93
|
-
git checkout -b "$BRANCH_NAME"
|
|
94
|
-
git push -u origin "$BRANCH_NAME"
|
|
95
|
-
echo "success=true" >> $GITHUB_OUTPUT
|
|
96
|
-
echo "message=Successfully created branch $BRANCH_NAME" >> $GITHUB_OUTPUT
|
|
97
|
-
;;
|
|
98
|
-
"delete")
|
|
99
|
-
echo "๐๏ธ Deleting branch $TARGET"
|
|
100
|
-
git push origin --delete "$TARGET"
|
|
101
|
-
echo "success=true" >> $GITHUB_OUTPUT
|
|
102
|
-
echo "message=Successfully deleted branch $TARGET" >> $GITHUB_OUTPUT
|
|
103
|
-
;;
|
|
104
|
-
esac
|
|
105
|
-
|
|
106
|
-
- name: Action Summary
|
|
107
|
-
shell: bash
|
|
108
|
-
run: |
|
|
109
|
-
if [ "${{ steps.branch-action.outputs.success }}" == "true" ]; then
|
|
110
|
-
echo "โ
${{ steps.branch-action.outputs.message }}"
|
|
111
|
-
else
|
|
112
|
-
echo "โ ${{ steps.branch-action.outputs.message }}"
|
|
113
|
-
fi
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
name: 'Promote Branch'
|
|
2
|
-
description: 'Promote code from source to target branch via temporary branch + PR'
|
|
3
|
-
author: 'PipeCraft'
|
|
4
|
-
|
|
5
|
-
inputs:
|
|
6
|
-
sourceBranch:
|
|
7
|
-
description: 'Source branch to promote from (defaults to github.ref_name)'
|
|
8
|
-
required: false
|
|
9
|
-
default: ${{ github.ref_name }}
|
|
10
|
-
version:
|
|
11
|
-
description: 'Version being promoted (e.g., v1.2.3, auto-detected from git tags if not provided)'
|
|
12
|
-
required: false
|
|
13
|
-
default: ''
|
|
14
|
-
run_number:
|
|
15
|
-
description: 'Original run number from develop branch to track across promotions'
|
|
16
|
-
required: false
|
|
17
|
-
default: ''
|
|
18
|
-
configPath:
|
|
19
|
-
description: 'Path to .pipecraftrc.json config file'
|
|
20
|
-
required: false
|
|
21
|
-
default: '.pipecraftrc.json'
|
|
22
|
-
tempBranchPattern:
|
|
23
|
-
description: 'Pattern for temp branch name'
|
|
24
|
-
required: false
|
|
25
|
-
default: 'release/{source}-to-{target}-{version}'
|
|
26
|
-
token:
|
|
27
|
-
description: 'GitHub token for authentication'
|
|
28
|
-
required: false
|
|
29
|
-
default: ${{ github.token }}
|
|
30
|
-
|
|
31
|
-
outputs:
|
|
32
|
-
prNumber:
|
|
33
|
-
description: 'The created PR number'
|
|
34
|
-
value: ${{ steps.create-pr.outputs.prNumber }}
|
|
35
|
-
prUrl:
|
|
36
|
-
description: 'The created PR URL'
|
|
37
|
-
value: ${{ steps.create-pr.outputs.prUrl }}
|
|
38
|
-
tempBranch:
|
|
39
|
-
description: 'The temporary branch name'
|
|
40
|
-
value: ${{ steps.create-temp.outputs.tempBranch }}
|
|
41
|
-
targetBranch:
|
|
42
|
-
description: 'The target branch determined from config'
|
|
43
|
-
value: ${{ steps.read-config.outputs.targetBranch }}
|
|
44
|
-
autoMerge:
|
|
45
|
-
description: 'The autoMerge setting for the target branch'
|
|
46
|
-
value: ${{ steps.read-config.outputs.autoMerge }}
|
|
47
|
-
|
|
48
|
-
runs:
|
|
49
|
-
using: 'composite'
|
|
50
|
-
steps:
|
|
51
|
-
- name: Checkout Code
|
|
52
|
-
uses: actions/checkout@v4
|
|
53
|
-
with:
|
|
54
|
-
fetch-depth: 0
|
|
55
|
-
token: ${{ inputs.token }}
|
|
56
|
-
|
|
57
|
-
- name: Read Config and Determine Target Branch
|
|
58
|
-
id: read-config
|
|
59
|
-
shell: bash
|
|
60
|
-
run: |
|
|
61
|
-
SOURCE="${{ inputs.sourceBranch }}"
|
|
62
|
-
CONFIG_PATH="${{ inputs.configPath }}"
|
|
63
|
-
|
|
64
|
-
echo "๐ Reading config from $CONFIG_PATH"
|
|
65
|
-
|
|
66
|
-
# Check if config file exists
|
|
67
|
-
if [ ! -f "$CONFIG_PATH" ]; then
|
|
68
|
-
echo "โ Config file not found: $CONFIG_PATH"
|
|
69
|
-
exit 1
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
# Read branchFlow array from config
|
|
73
|
-
BRANCH_FLOW=$(cat "$CONFIG_PATH" | jq -r '.branchFlow | join(" ")')
|
|
74
|
-
echo "๐ Branch flow: $BRANCH_FLOW"
|
|
75
|
-
|
|
76
|
-
# Convert to array
|
|
77
|
-
IFS=' ' read -ra BRANCHES <<< "$BRANCH_FLOW"
|
|
78
|
-
|
|
79
|
-
# Find current branch index and determine target
|
|
80
|
-
TARGET=""
|
|
81
|
-
for i in "${!BRANCHES[@]}"; do
|
|
82
|
-
if [ "${BRANCHES[$i]}" == "$SOURCE" ]; then
|
|
83
|
-
# Get next branch in flow
|
|
84
|
-
NEXT_INDEX=$((i + 1))
|
|
85
|
-
if [ $NEXT_INDEX -lt ${#BRANCHES[@]} ]; then
|
|
86
|
-
TARGET="${BRANCHES[$NEXT_INDEX]}"
|
|
87
|
-
fi
|
|
88
|
-
break
|
|
89
|
-
fi
|
|
90
|
-
done
|
|
91
|
-
|
|
92
|
-
if [ -z "$TARGET" ]; then
|
|
93
|
-
echo "โ Could not determine target branch for source: $SOURCE"
|
|
94
|
-
echo " Branch flow: $BRANCH_FLOW"
|
|
95
|
-
exit 1
|
|
96
|
-
fi
|
|
97
|
-
|
|
98
|
-
echo "โ
Target branch: $TARGET"
|
|
99
|
-
echo "targetBranch=$TARGET" >> $GITHUB_OUTPUT
|
|
100
|
-
|
|
101
|
-
# Determine autoMerge setting for target branch
|
|
102
|
-
AUTO_MERGE=$(cat "$CONFIG_PATH" | jq -r ".autoMerge.\"$TARGET\" // false")
|
|
103
|
-
echo "๐ Auto-merge for $TARGET: $AUTO_MERGE"
|
|
104
|
-
echo "autoMerge=$AUTO_MERGE" >> $GITHUB_OUTPUT
|
|
105
|
-
|
|
106
|
-
- name: Get Version
|
|
107
|
-
id: get-version
|
|
108
|
-
shell: bash
|
|
109
|
-
run: |
|
|
110
|
-
VERSION_INPUT="${{ inputs.version }}"
|
|
111
|
-
|
|
112
|
-
if [ -n "$VERSION_INPUT" ]; then
|
|
113
|
-
VERSION="$VERSION_INPUT"
|
|
114
|
-
echo "๐ Using provided version: $VERSION"
|
|
115
|
-
else
|
|
116
|
-
# Auto-detect from git tags
|
|
117
|
-
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.1.0")
|
|
118
|
-
echo "๐ท๏ธ Auto-detected version from tags: $VERSION"
|
|
119
|
-
fi
|
|
120
|
-
|
|
121
|
-
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
122
|
-
|
|
123
|
-
- name: Create Temporary Branch
|
|
124
|
-
id: create-temp
|
|
125
|
-
shell: bash
|
|
126
|
-
run: |
|
|
127
|
-
SOURCE="${{ inputs.sourceBranch }}"
|
|
128
|
-
TARGET="${{ steps.read-config.outputs.targetBranch }}"
|
|
129
|
-
VERSION="${{ steps.get-version.outputs.version }}"
|
|
130
|
-
PATTERN="${{ inputs.tempBranchPattern }}"
|
|
131
|
-
|
|
132
|
-
# Remove 'v' prefix from version for branch name
|
|
133
|
-
VERSION_CLEAN="${VERSION#v}"
|
|
134
|
-
|
|
135
|
-
# Replace placeholders in pattern
|
|
136
|
-
TEMP_BRANCH="$PATTERN"
|
|
137
|
-
TEMP_BRANCH="${TEMP_BRANCH//{source\}/$SOURCE}"
|
|
138
|
-
TEMP_BRANCH="${TEMP_BRANCH//{target\}/$TARGET}"
|
|
139
|
-
TEMP_BRANCH="${TEMP_BRANCH//{version\}/$VERSION_CLEAN}"
|
|
140
|
-
|
|
141
|
-
echo "๐ฟ Preparing temporary branch: $TEMP_BRANCH"
|
|
142
|
-
echo " From: $SOURCE"
|
|
143
|
-
echo " To: $TARGET"
|
|
144
|
-
echo " Version: $VERSION"
|
|
145
|
-
|
|
146
|
-
# Ensure we're on the source branch
|
|
147
|
-
git checkout "$SOURCE"
|
|
148
|
-
|
|
149
|
-
# Check if temp branch already exists locally or remotely
|
|
150
|
-
if git show-ref --verify --quiet refs/heads/"$TEMP_BRANCH" || git ls-remote --heads origin "$TEMP_BRANCH" | grep -q "$TEMP_BRANCH"; then
|
|
151
|
-
echo "โ ๏ธ Temp branch $TEMP_BRANCH already exists, using existing branch"
|
|
152
|
-
# Fetch and checkout existing branch
|
|
153
|
-
git fetch origin "$TEMP_BRANCH" 2>/dev/null || true
|
|
154
|
-
git checkout "$TEMP_BRANCH" 2>/dev/null || git checkout -b "$TEMP_BRANCH" origin/"$TEMP_BRANCH"
|
|
155
|
-
else
|
|
156
|
-
echo "๐ Creating new temp branch $TEMP_BRANCH"
|
|
157
|
-
# Create temp branch from current commit
|
|
158
|
-
git checkout -b "$TEMP_BRANCH"
|
|
159
|
-
# Push temp branch to remote
|
|
160
|
-
git push origin "$TEMP_BRANCH"
|
|
161
|
-
fi
|
|
162
|
-
|
|
163
|
-
echo "tempBranch=$TEMP_BRANCH" >> $GITHUB_OUTPUT
|
|
164
|
-
echo "โ
Temporary branch ready"
|
|
165
|
-
|
|
166
|
-
- name: Check for Existing PR
|
|
167
|
-
id: check-pr
|
|
168
|
-
shell: bash
|
|
169
|
-
env:
|
|
170
|
-
GH_TOKEN: ${{ inputs.token }}
|
|
171
|
-
run: |
|
|
172
|
-
TEMP_BRANCH="${{ steps.create-temp.outputs.tempBranch }}"
|
|
173
|
-
TARGET="${{ steps.read-config.outputs.targetBranch }}"
|
|
174
|
-
|
|
175
|
-
# Check if PR already exists from temp branch to target
|
|
176
|
-
EXISTING_PR=$(gh pr list --head "$TEMP_BRANCH" --base "$TARGET" --json number --jq '.[0].number' 2>/dev/null || echo "")
|
|
177
|
-
|
|
178
|
-
if [ -n "$EXISTING_PR" ]; then
|
|
179
|
-
echo "exists=true" >> $GITHUB_OUTPUT
|
|
180
|
-
echo "prNumber=$EXISTING_PR" >> $GITHUB_OUTPUT
|
|
181
|
-
echo "โ ๏ธ PR already exists: #$EXISTING_PR"
|
|
182
|
-
|
|
183
|
-
# Get PR URL
|
|
184
|
-
PR_URL=$(gh pr view "$EXISTING_PR" --json url --jq '.url')
|
|
185
|
-
echo "prUrl=$PR_URL" >> $GITHUB_OUTPUT
|
|
186
|
-
else
|
|
187
|
-
echo "exists=false" >> $GITHUB_OUTPUT
|
|
188
|
-
echo "โ
No existing PR found"
|
|
189
|
-
fi
|
|
190
|
-
|
|
191
|
-
- name: Create Pull Request
|
|
192
|
-
id: create-pr
|
|
193
|
-
if: steps.check-pr.outputs.exists == 'false'
|
|
194
|
-
shell: bash
|
|
195
|
-
env:
|
|
196
|
-
GH_TOKEN: ${{ inputs.token }}
|
|
197
|
-
run: |
|
|
198
|
-
TEMP_BRANCH="${{ steps.create-temp.outputs.tempBranch }}"
|
|
199
|
-
TARGET="${{ steps.read-config.outputs.targetBranch }}"
|
|
200
|
-
SOURCE="${{ inputs.sourceBranch }}"
|
|
201
|
-
VERSION="${{ steps.get-version.outputs.version }}"
|
|
202
|
-
AUTO_MERGE="${{ steps.read-config.outputs.autoMerge }}"
|
|
203
|
-
|
|
204
|
-
TITLE="๐ Release $VERSION to $TARGET"
|
|
205
|
-
|
|
206
|
-
# Determine merge behavior text
|
|
207
|
-
if [ "$AUTO_MERGE" == "true" ]; then
|
|
208
|
-
MERGE_TEXT="merge automatically"
|
|
209
|
-
else
|
|
210
|
-
MERGE_TEXT="require manual approval"
|
|
211
|
-
fi
|
|
212
|
-
|
|
213
|
-
# Disable error exit to capture gh pr create output even on failure
|
|
214
|
-
set +e
|
|
215
|
-
|
|
216
|
-
# Create the PR - gh pr create returns the PR URL on success
|
|
217
|
-
PR_URL=$(gh pr create \--title "$TITLE" \--body "Release $VERSION from $SOURCE to $TARGET" \--head "$TEMP_BRANCH" \--base "$TARGET" 2>&1)
|
|
218
|
-
PR_EXIT_CODE=$?
|
|
219
|
-
|
|
220
|
-
# Re-enable error exit
|
|
221
|
-
set -e
|
|
222
|
-
|
|
223
|
-
if [ $PR_EXIT_CODE -eq 0 ] && [[ "$PR_URL" =~ ^https://github.com/.*/pull/[0-9]+$ ]]; then
|
|
224
|
-
# Extract PR number from URL (e.g., https://github.com/owner/repo/pull/123)
|
|
225
|
-
PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$')
|
|
226
|
-
echo "prNumber=$PR_NUMBER" >> $GITHUB_OUTPUT
|
|
227
|
-
echo "prUrl=$PR_URL" >> $GITHUB_OUTPUT
|
|
228
|
-
echo "โ
Created PR #$PR_NUMBER"
|
|
229
|
-
echo "๐ URL: $PR_URL"
|
|
230
|
-
else
|
|
231
|
-
echo "โ Failed to create PR"
|
|
232
|
-
echo "Error output:"
|
|
233
|
-
echo "$PR_URL"
|
|
234
|
-
exit 1
|
|
235
|
-
fi
|
|
236
|
-
|
|
237
|
-
- name: Enable PR Auto-Merge with Rebase (Manual Approval Required)
|
|
238
|
-
if: steps.read-config.outputs.autoMerge == 'false'
|
|
239
|
-
shell: bash
|
|
240
|
-
env:
|
|
241
|
-
GH_TOKEN: ${{ inputs.token }}
|
|
242
|
-
run: |
|
|
243
|
-
PR_NUMBER="${{ steps.check-pr.outputs.prNumber || steps.create-pr.outputs.prNumber }}"
|
|
244
|
-
TARGET="${{ steps.read-config.outputs.targetBranch }}"
|
|
245
|
-
|
|
246
|
-
echo "๐ Enabling auto-merge with rebase for PR #$PR_NUMBER (requires approval)"
|
|
247
|
-
echo " This will fast-forward $TARGET when approved, maintaining linear history"
|
|
248
|
-
|
|
249
|
-
# Enable auto-merge with rebase method (fast-forward, no merge commit)
|
|
250
|
-
gh pr merge "$PR_NUMBER" --auto --rebase
|
|
251
|
-
|
|
252
|
-
echo "โ
Auto-merge enabled - PR will fast-forward merge when approved"
|
|
253
|
-
echo "โ ๏ธ Manual approval required before merge completes"
|
|
254
|
-
|
|
255
|
-
- name: Fast-Forward Merge (Immediate Auto-Merge)
|
|
256
|
-
if: steps.read-config.outputs.autoMerge == 'true'
|
|
257
|
-
shell: bash
|
|
258
|
-
run: |
|
|
259
|
-
SOURCE="${{ inputs.sourceBranch }}"
|
|
260
|
-
TARGET="${{ steps.read-config.outputs.targetBranch }}"
|
|
261
|
-
VERSION="${{ steps.get-version.outputs.version }}"
|
|
262
|
-
|
|
263
|
-
echo "๐ Fast-forwarding $TARGET to $SOURCE (maintaining linear history)"
|
|
264
|
-
|
|
265
|
-
# Get the commit SHA from source branch
|
|
266
|
-
COMMIT_SHA=$(git rev-parse $SOURCE)
|
|
267
|
-
echo "Source commit: $COMMIT_SHA"
|
|
268
|
-
|
|
269
|
-
# Fetch target branch
|
|
270
|
-
git fetch origin $TARGET:$TARGET 2>/dev/null || true
|
|
271
|
-
|
|
272
|
-
# Checkout target branch
|
|
273
|
-
git checkout $TARGET
|
|
274
|
-
|
|
275
|
-
# Verify we can fast-forward (no divergent commits)
|
|
276
|
-
if git merge-base --is-ancestor $TARGET $SOURCE; then
|
|
277
|
-
echo "โ
Fast-forward is possible (linear history maintained)"
|
|
278
|
-
else
|
|
279
|
-
echo "โ Cannot fast-forward - branches have diverged"
|
|
280
|
-
echo "Target branch has commits not in source branch"
|
|
281
|
-
exit 1
|
|
282
|
-
fi
|
|
283
|
-
|
|
284
|
-
# Fast-forward merge (no merge commit)
|
|
285
|
-
git merge --ff-only $SOURCE
|
|
286
|
-
|
|
287
|
-
# Push to remote
|
|
288
|
-
git push origin $TARGET
|
|
289
|
-
|
|
290
|
-
echo "โ
Fast-forwarded $TARGET to $COMMIT_SHA"
|
|
291
|
-
echo "๐ PR will be closed automatically for audit trail"
|
|
292
|
-
|
|
293
|
-
- name: Trigger Pipeline Workflow on Target Branch
|
|
294
|
-
if: steps.read-config.outputs.autoMerge == 'true'
|
|
295
|
-
shell: bash
|
|
296
|
-
env:
|
|
297
|
-
GH_TOKEN: ${{ inputs.token }}
|
|
298
|
-
run: |
|
|
299
|
-
TARGET="${{ steps.read-config.outputs.targetBranch }}"
|
|
300
|
-
VERSION="${{ steps.get-version.outputs.version }}"
|
|
301
|
-
RUN_NUMBER="${{ inputs.run_number }}"
|
|
302
|
-
|
|
303
|
-
echo "๐ Triggering pipeline workflow on $TARGET branch with version $VERSION"
|
|
304
|
-
|
|
305
|
-
if [ -n "$RUN_NUMBER" ]; then
|
|
306
|
-
echo " Tracking original run number: $RUN_NUMBER"
|
|
307
|
-
fi
|
|
308
|
-
|
|
309
|
-
# Trigger the pipeline workflow on the target branch
|
|
310
|
-
# This is necessary because GITHUB_TOKEN pushes don't trigger workflows by default
|
|
311
|
-
# Pass the version and run_number so runs can be tracked across promotions
|
|
312
|
-
if [ -n "$RUN_NUMBER" ]; then
|
|
313
|
-
gh workflow run pipeline.yml --ref "$TARGET" --field version="$VERSION" --field run_number="$RUN_NUMBER"
|
|
314
|
-
else
|
|
315
|
-
gh workflow run pipeline.yml --ref "$TARGET" --field version="$VERSION"
|
|
316
|
-
fi
|
|
317
|
-
|
|
318
|
-
echo "โ
Pipeline workflow triggered on $TARGET with version $VERSION"
|
|
319
|
-
|
|
320
|
-
- name: Close PR and Delete Branch
|
|
321
|
-
if: steps.read-config.outputs.autoMerge == 'true'
|
|
322
|
-
shell: bash
|
|
323
|
-
env:
|
|
324
|
-
GH_TOKEN: ${{ inputs.token }}
|
|
325
|
-
run: |
|
|
326
|
-
TEMP_BRANCH="${{ steps.create-temp.outputs.tempBranch }}"
|
|
327
|
-
PR_NUMBER="${{ steps.check-pr.outputs.prNumber || steps.create-pr.outputs.prNumber }}"
|
|
328
|
-
|
|
329
|
-
echo "๐งน Cleaning up temporary branch: $TEMP_BRANCH"
|
|
330
|
-
|
|
331
|
-
# Close the PR (it's already been fast-forward merged)
|
|
332
|
-
if [ -n "$PR_NUMBER" ]; then
|
|
333
|
-
gh pr close "$PR_NUMBER" --comment "Automatically merged via fast-forward. Closing PR and cleaning up release branch." || true
|
|
334
|
-
echo "โ
Closed PR #$PR_NUMBER"
|
|
335
|
-
fi
|
|
336
|
-
|
|
337
|
-
# Delete the temporary branch from remote
|
|
338
|
-
git push origin --delete "$TEMP_BRANCH" || echo "โ ๏ธ Branch may already be deleted"
|
|
339
|
-
|
|
340
|
-
echo "โ
Deleted temporary branch $TEMP_BRANCH"
|
|
341
|
-
|
|
342
|
-
- name: Use Existing PR
|
|
343
|
-
if: steps.check-pr.outputs.exists == 'true'
|
|
344
|
-
shell: bash
|
|
345
|
-
run: |
|
|
346
|
-
PR_NUMBER="${{ steps.check-pr.outputs.prNumber }}"
|
|
347
|
-
PR_URL="${{ steps.check-pr.outputs.prUrl }}"
|
|
348
|
-
|
|
349
|
-
echo "โน๏ธ Using existing PR #$PR_NUMBER"
|
|
350
|
-
echo "๐ URL: $PR_URL"
|
|
351
|
-
|
|
352
|
-
# Note: Fast-forward merge happens in separate step if autoMerge is enabled
|