Skip to content

Commit 3b12eb6

Browse files
authored
Merge pull request #529 from codex-team/fix-bump-workflow
Update GitHub Actions workflow to check for version bumps
2 parents dfbbff7 + 010a1f4 commit 3b12eb6

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

.github/workflows/bump-version.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ jobs:
66
# If pull request was merged then we should check for a package version update
77
check-version-update:
88
runs-on: ubuntu-22.04
9+
outputs:
10+
should-bump: ${{ steps.version-check.outputs.should-bump }}
911
steps:
1012
# Checkout to target branch
11-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v5
1214
with:
1315
fetch-depth: 0
1416

@@ -26,20 +28,29 @@ jobs:
2628
id: packageOld
2729
uses: codex-team/action-nodejs-package-info@v1
2830

29-
# Stop workflow and do not bump version if it was changed already
30-
- name: Stop workflow and do not bump version if it was changed already
31-
uses: andymckay/cancel-action@0.2
32-
if: steps.packageOld.outputs.version != steps.packageNew.outputs.version
31+
# Check if version should be bumped
32+
- name: Check if version should be bumped
33+
id: version-check
34+
run: |
35+
if [ "${{ steps.packageOld.outputs.version }}" == "${{ steps.packageNew.outputs.version }}" ]; then
36+
echo "should-bump=true" >> $GITHUB_OUTPUT
37+
else
38+
echo "should-bump=false" >> $GITHUB_OUTPUT
39+
fi
3340
3441
bump-version:
3542
needs: check-version-update
43+
if: needs.check-version-update.outputs.should-bump == 'true'
3644
runs-on: ubuntu-22.04
3745
steps:
3846
# Checkout to target branch
39-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v5
48+
with:
49+
repository: ${{ github.event.pull_request.head.repo.full_name }}
50+
ref: ${{ github.event.pull_request.head.ref }}
4051

4152
# Setup node environment
42-
- uses: actions/setup-node@v3
53+
- uses: actions/setup-node@v5
4354
with:
4455
node-version-file: '.nvmrc'
4556
registry-url: https://registry.npmjs.org/
@@ -54,7 +65,7 @@ jobs:
5465
uses: codex-team/action-nodejs-package-info@v1
5566

5667
# Commit version upgrade
57-
- uses: EndBug/add-and-commit@v7
68+
- uses: EndBug/add-and-commit@v9
5869
with:
5970
author_name: github-actions
6071
author_email: 41898282+github-actions[bot]@users.noreply.github.com

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hawk.api",
3-
"version": "1.1.35",
3+
"version": "1.1.36",
44
"main": "index.ts",
55
"license": "UNLICENSED",
66
"scripts": {

0 commit comments

Comments
 (0)