@@ -20,8 +20,27 @@ permissions:
2020 pull-requests : write
2121
2222jobs :
23+ # Job 0: Skip if triggered by bot commit (prevent infinite loop)
24+ check-trigger :
25+ runs-on : ubuntu-latest
26+ outputs :
27+ should_run : ${{ steps.check.outputs.should_run }}
28+ steps :
29+ - name : Check if triggered by bot
30+ id : check
31+ shell : bash
32+ run : |
33+ if [[ "${{ github.event.head_commit.author.name }}" == "github-actions[bot]" ]]; then
34+ echo "Skipping workflow - triggered by bot commit"
35+ echo "should_run=false" >> $GITHUB_OUTPUT
36+ else
37+ echo "should_run=true" >> $GITHUB_OUTPUT
38+ fi
39+
2340 # Job 1: Auto-bump version if it matches the published npm version
2441 auto-version-bump :
42+ needs : check-trigger
43+ if : needs.check-trigger.outputs.should_run == 'true'
2544 runs-on : ubuntu-latest
2645 outputs :
2746 package_name : ${{ steps.detect.outputs.package_name }}
@@ -113,6 +132,7 @@ jobs:
113132 # Job 2: Validate the release PR (runs after version bump)
114133 validate-release-pr :
115134 needs : auto-version-bump
135+ if : needs.auto-version-bump.result == 'success'
116136 runs-on : ubuntu-latest
117137 steps :
118138 - name : Checkout code
@@ -121,6 +141,12 @@ jobs:
121141 ref : ${{ github.head_ref }}
122142 fetch-depth : 0
123143
144+ - name : Pull latest changes
145+ shell : bash
146+ run : |
147+ # Ensure we have the latest commit (including any version bump from Job 1)
148+ git pull origin ${{ github.head_ref }} --ff-only || true
149+
124150 - name : Setup Node.js
125151 uses : actions/setup-node@v4
126152 with :
@@ -131,10 +157,18 @@ jobs:
131157 shell : bash
132158 run : npm ci
133159
160+ - name : Get current version from file
161+ id : current-version
162+ shell : bash
163+ run : |
164+ # Read version directly from file to ensure we have the latest
165+ VERSION=$(node -p "require('./${{ needs.auto-version-bump.outputs.package_path }}/package.json').version")
166+ echo "version=$VERSION" >> $GITHUB_OUTPUT
167+
134168 - name : Validate version is ready for publish
135169 shell : bash
136170 run : |
137- VERSION="${{ needs.auto -version-bump .outputs.version }}"
171+ VERSION="${{ steps.current -version.outputs.version }}"
138172 NPM="${{ needs.auto-version-bump.outputs.npm_version }}"
139173 WAS_BUMPED="${{ needs.auto-version-bump.outputs.was_bumped }}"
140174
@@ -184,7 +218,7 @@ jobs:
184218 uses : actions/github-script@v7
185219 with :
186220 script : |
187- const version = '${{ needs.auto -version-bump .outputs.version }}';
221+ const version = '${{ steps.current -version.outputs.version }}';
188222 const package_name = '${{ needs.auto-version-bump.outputs.package_name }}';
189223 const npm_version = '${{ needs.auto-version-bump.outputs.npm_version }}';
190224 const was_bumped = '${{ needs.auto-version-bump.outputs.was_bumped }}';
@@ -194,26 +228,26 @@ jobs:
194228 : '';
195229
196230 const body = `## 🚀 Release Validation Passed
197- ${bumpNote}
198- | Property | Value |
199- |----------|-------|
200- | **Package** | \`${package_name}\` |
201- | **Version to Publish** | \`${version}\` |
202- | **Current npm Version** | \`${npm_version}\` |
203-
204- # ## Pre-Publish Checklist
205- - [x] Version bump validated (auto-bumped : ${was_bumped})
206- - [x] Lint validation passed
207- - [x] Tests passed
208- - [x] Type checking passed
209- - [x] Build successful
210-
211- # ## What happens on merge?
212- 1. Package will be published to npm with provenance
213- 2. Git tag \`${package_name}@${version}\` will be created
214- 3. GitHub Release will be created
215-
216- **Merge this PR to publish to npm.**`;
231+ ${bumpNote}
232+ | Property | Value |
233+ |----------|-------|
234+ | **Package** | \`${package_name}\` |
235+ | **Version to Publish** | \`${version}\` |
236+ | **Current npm Version** | \`${npm_version}\` |
237+
238+ ### Pre-Publish Checklist
239+ - [x] Version bump validated (auto-bumped: ${was_bumped})
240+ - [x] Lint validation passed
241+ - [x] Tests passed
242+ - [x] Type checking passed
243+ - [x] Build successful
244+
245+ ### What happens on merge?
246+ 1. Package will be published to npm with provenance
247+ 2. Git tag \`${package_name}@${version}\` will be created
248+ 3. GitHub Release will be created
249+
250+ **Merge this PR to publish to npm.**`;
217251
218252 github.rest.issues.createComment({
219253 issue_number: context.issue.number,
0 commit comments