Skip to content

Commit 4000d77

Browse files
Merge pull request #15 from HichemTab-tech/fix-workflow
Enhance auto-bumper workflow version handling
2 parents ed604c7 + c17c2a7 commit 4000d77

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/auto-bumper.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,32 @@ jobs:
128128
if: steps.perm.outputs.allowed == 'true'
129129
run: |
130130
pnpm run bump
131+
132+
- name: Retrieve new version
133+
id: ver
134+
uses: actions/github-script@v7
135+
with:
136+
script: |
137+
const fs = require('fs');
138+
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
139+
core.setOutput('version', String(pkg.version));
140+
141+
- name: Commit changes
142+
if: steps.perm.outputs.allowed == 'true'
143+
run: |
131144
git add package.json
132-
git commit -m "chore: bump version"
145+
git commit -m "chore: bump version to ${{ steps.ver.outputs.version }}"
133146
git push
134147
135148
- name: Add comment to PR
136149
if: steps.perm.outputs.allowed == 'true'
137150
uses: actions/github-script@v7
138151
with:
139152
script: |
140-
const fs = require('fs');
141-
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
153+
const version = ${{ steps.ver.outputs.version }}
142154
github.rest.issues.createComment({
143155
issue_number: context.issue.number,
144156
owner: context.repo.owner,
145157
repo: context.repo.repo,
146-
body: `✅ Version bumped to ${pkg.version}`
158+
body: `✅ Version bumped to ${version}`
147159
})

0 commit comments

Comments
 (0)