@@ -46,14 +46,14 @@ jobs:
4646 ref : ${{ github.head_ref }}
4747 token : ${{ secrets.GITHUB_TOKEN }}
4848 fetch-depth : 0
49-
49+
5050 - name : Checkout PR head (fork PR)
5151 if : steps.repo-check.outputs.is_same_repo == 'false'
5252 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5353 with :
5454 ref : ${{ github.event.pull_request.head.sha }}
5555 fetch-depth : 0
56-
56+
5757 - name : Import GPG key (same-repo only)
5858 if : steps.repo-check.outputs.is_same_repo == 'true'
5959 uses : crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
@@ -62,35 +62,35 @@ jobs:
6262 passphrase : ${{ secrets.GPG_PASSPHRASE }}
6363 git_user_signingkey : true
6464 git_commit_gpgsign : true
65-
65+
6666 - name : Setup Node.js
6767 uses : actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
6868 with :
6969 node-version : ' 20'
70-
70+
7171 - name : Check if version needs bump
7272 id : check
7373 run : |
7474 set -euo pipefail
75-
75+
7676 # Get current version from PR branch
7777 CURRENT=$(node -p "require('./package.json').version")
7878 echo "Current version on PR branch: ${CURRENT}"
79-
79+
8080 # Get version from main branch
8181 git fetch origin main
8282 MAIN_VERSION=$(git show origin/main:package.json | node -p "JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8')).version")
8383 echo "Version on main branch: ${MAIN_VERSION}"
84-
84+
8585 # Calculate next version for reference
8686 NEXT_VERSION=$(node -e "
8787 const version = '${MAIN_VERSION}';
8888 let parts = version.split('.').map(Number);
89-
89+
9090 // Normalize first
9191 if (parts[2] > 9) { parts[2] = 0; parts[1] += 1; }
9292 if (parts[1] > 9) { parts[1] = 0; parts[0] += 1; parts[2] = 0; }
93-
93+
9494 // Increment
9595 parts[2] += 1;
9696 if (parts[2] > 9) {
@@ -104,7 +104,7 @@ jobs:
104104 console.log(parts.join('.'));
105105 ")
106106 echo "next_version=${NEXT_VERSION}" >> $GITHUB_OUTPUT
107-
107+
108108 # Check if version needs bump or already bumped
109109 if [ "$CURRENT" = "$MAIN_VERSION" ]; then
110110 echo "needs_bump=true" >> $GITHUB_OUTPUT
@@ -115,63 +115,63 @@ jobs:
115115 echo "current_version=$CURRENT" >> $GITHUB_OUTPUT
116116 echo "✓ Version already bumped (current: ${CURRENT}, main: ${MAIN_VERSION})"
117117 fi
118-
118+
119119 - name : Auto bump version (same-repo only)
120120 if : steps.repo-check.outputs.is_same_repo == 'true' && steps.check.outputs.needs_bump == 'true'
121121 id : bump
122122 run : |
123123 set -euo pipefail
124-
124+
125125 echo "Running bump-version.js script..."
126-
126+
127127 # Set environment for PR context
128128 export GITHUB_HEAD_REF="${{ github.head_ref }}"
129129 export CI="true"
130-
130+
131131 # Run the bump script
132132 node scripts/bump-version.js
133-
133+
134134 # Get the new version
135135 NEW_VERSION=$(node -p "require('./package.json').version")
136136 echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
137137 echo "✓ Version bumped to ${NEW_VERSION}"
138-
138+
139139 # Configure git identity for commits
140140 # Note: GPG action configures signing, but we must explicitly set user identity
141141 git config user.name "github-actions[bot]"
142142 git config user.email "github-actions[bot]@users.noreply.github.com"
143-
143+
144144 # Stage and commit changes
145145 # Note: Files are explicitly listed (not git add -u) to ensure only version files are committed
146146 # This matches the files updated by bump-version.js
147147 git add package.json package-lock.json .example.env public/api-docs/openapi.yaml
148-
148+
149149 # Check if there are changes to commit
150150 if git diff --staged --quiet; then
151151 echo "⚠️ No changes to commit after running bump script"
152152 exit 0
153153 fi
154-
154+
155155 git commit -m "chore: auto-bump version to v${NEW_VERSION}"
156156 git push
157-
157+
158158 echo "✓ Changes committed and pushed"
159-
159+
160160 - name : Comment on PR (same-repo with auto-bump)
161161 if : steps.repo-check.outputs.is_same_repo == 'true' && steps.check.outputs.needs_bump == 'true' && steps.bump.outputs.new_version != ''
162162 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
163163 with :
164164 script : |
165165 const newVersion = '${{ steps.bump.outputs.new_version }}';
166-
166+
167167 // Check for existing bump comments to avoid spam on synchronize events
168168 const { data: comments } = await github.rest.issues.listComments({
169169 issue_number: context.issue.number,
170170 owner: context.repo.owner,
171171 repo: context.repo.repo,
172172 per_page: 100,
173173 });
174-
174+
175175 const bumpPrefix = '✅ **Version automatically bumped to';
176176 const existingBumpComment = comments
177177 .slice()
@@ -181,26 +181,26 @@ jobs:
181181 const hasPrefix = typeof comment.body === 'string' && comment.body.startsWith(bumpPrefix);
182182 return isBot && hasPrefix;
183183 });
184-
184+
185185 const isRebump = !!existingBumpComment;
186- const rebumpNote = isRebump
187- ? '\n\n_Note: A previous automatic bump was performed. This is a re-bump after the PR was updated (e.g., rebased or synced with main)._'
186+ const rebumpNote = isRebump
187+ ? '\n\n_Note: A previous automatic bump was performed. This is a re-bump after the PR was updated (e.g., rebased or synced with main)._'
188188 : '';
189-
189+
190190 await github.rest.issues.createComment({
191191 issue_number: context.issue.number,
192192 owner: context.repo.owner,
193193 repo: context.repo.repo,
194194 body: `✅ **Version automatically bumped to \`v${newVersion}\`**
195195
196- This PR now includes the version bump commit.${rebumpNote}
196+ This PR now includes the version bump commit.${rebumpNote}
197197
198- **Rollover versioning:** X.Y.Z where X ≥ 0 and Y, Z ∈ {0-9}
199- - Example : 1.6.9 → 1.7.0, 1.9.9 → 2.0.0, 9.9.9 → 10.0.0
198+ **Rollover versioning:** X.Y.Z where X ≥ 0 and Y, Z ∈ {0-9}
199+ - Example: 1.6.9 → 1.7.0, 1.9.9 → 2.0.0, 9.9.9 → 10.0.0
200200
201- This PR is ready for review! 🚀`
201+ This PR is ready for review! 🚀`
202202 });
203-
203+
204204 - name : Comment on PR (same-repo, already bumped)
205205 if : steps.repo-check.outputs.is_same_repo == 'true' && steps.check.outputs.needs_bump == 'false' && github.event.action != 'synchronize'
206206 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
@@ -213,11 +213,11 @@ This PR is ready for review! 🚀`
213213 repo: context.repo.repo,
214214 body: `✅ **Version already bumped to \`v${currentVersion}\`**
215215
216- No automatic version bump needed - the PR already includes a version update.
216+ No automatic version bump needed - the PR already includes a version update.
217217
218- This PR is ready for review! 🚀`
218+ This PR is ready for review! 🚀`
219219 });
220-
220+
221221 - name : Comment on PR (fork, needs bump)
222222 if : steps.repo-check.outputs.is_same_repo == 'false' && steps.check.outputs.needs_bump == 'true' && github.event.action != 'synchronize'
223223 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
@@ -231,29 +231,29 @@ This PR is ready for review! 🚀`
231231 repo: context.repo.repo,
232232 body: `👋 **Thank you for your contribution from a fork!**
233233
234- Since this PR is from a forked repository, the automatic version bump cannot run (for security reasons).
234+ Since this PR is from a forked repository, the automatic version bump cannot run (for security reasons).
235235
236- **Please manually bump the version before merging:**
236+ **Please manually bump the version before merging:**
237237
238- \`\`\`bash
239- # Current version on main: ${currentVersion}
240- # Suggested next version: ${nextVersion}
238+ \`\`\`bash
239+ # Current version on main: ${currentVersion}
240+ # Suggested next version: ${nextVersion}
241241
242- # From your PR branch, run the version bump script with PR context:
243- CI=true GITHUB_HEAD_REF="$(git rev-parse --abbrev-ref HEAD)" node scripts/bump-version.js
244- \`\`\`
242+ # From your PR branch, run the version bump script with PR context:
243+ CI=true GITHUB_HEAD_REF="$(git rev-parse --abbrev-ref HEAD)" node scripts/bump-version.js
244+ \`\`\`
245245
246- The script will update :
247- - \`package.json\` and \`package-lock.json\`
248- - \`.example.env\` (NEXT_PUBLIC_APP_VERSION)
249- - \`public/api-docs/openapi.yaml\`
246+ The script will update:
247+ - \`package.json\` and \`package-lock.json\`
248+ - \`.example.env\` (NEXT_PUBLIC_APP_VERSION)
249+ - \`public/api-docs/openapi.yaml\`
250250
251- **Rollover versioning:** X.Y.Z where X ≥ 0 and Y, Z ∈ {0-9}
252- - Example : 1.6.9 → 1.7.0, 1.9.9 → 2.0.0, 9.9.9 → 10.0.0
251+ **Rollover versioning:** X.Y.Z where X ≥ 0 and Y, Z ∈ {0-9}
252+ - Example: 1.6.9 → 1.7.0, 1.9.9 → 2.0.0, 9.9.9 → 10.0.0
253253
254- For more details, see [VERSIONING.md](https://github.com/${context.repo.owner}/${context.repo.repo}/blob/main/docs/VERSIONING.md).`
254+ For more details, see [VERSIONING.md](https://github.com/${context.repo.owner}/${context.repo.repo}/blob/main/docs/VERSIONING.md).`
255255 });
256-
256+
257257 - name : Comment on PR (fork, already bumped)
258258 if : steps.repo-check.outputs.is_same_repo == 'false' && steps.check.outputs.needs_bump == 'false' && github.event.action != 'synchronize'
259259 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
@@ -266,7 +266,7 @@ For more details, see [VERSIONING.md](https://github.com/${context.repo.owner}/$
266266 repo: context.repo.repo,
267267 body: `✅ **Version already bumped to \`v${currentVersion}\`**
268268
269- Great! This PR already includes a version update.
269+ Great! This PR already includes a version update.
270270
271- This PR is ready for review! 🚀`
271+ This PR is ready for review! 🚀`
272272 });
0 commit comments