gh-action-bump-version: Cannot read property '1' of null
Not sure which parts of the context will be relevant, so apologies for a long item.
I’m using npm workspaces and trying to write a GitHub action to increment the version number of one of the applications within my workspace once the pull request has been merged. Here’s my YAML:
name: 'Bump Version'
on:
pull_request:
branches: [main]
types:
- closed
paths:
- 'apps/ds-ui/**'
jobs:
bump_version:
name: 'Bump version Number for UI app'
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: 'Checkout source code'
uses: 'actions/checkout@v2'
with:
ref: ${{ github.ref }}
- name: 'Bump version for UI'
id: ui-bump
uses: 'phips28/gh-action-bump-version@master'
with:
tag-prefix: 'v'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: 'apps/ds-ui'
But when this runs I’m getting
✖ fatal TypeError: Cannot read property '1' of null
at /home/runner/work/_actions/phips[28](https://github.com/sernaferna/ds-wireframes/runs/6673294030?check_suite_focus=true#step:3:29)/gh-action-bump-version/master/index.js:144:77
at processTicksAndRejections (internal/process/task_queues.js:97:5)
✖ fatal Failed to bump version
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (9 by maintainers)
Commits related to this issue
- fix #166, more logs — committed to phips28/gh-action-bump-version by phips28 2 years ago
For those who are interested, here’s a final workflow I used for my npm workspaces monorepo. It contains three projects: ds-api, ds-ui, and ds-vapi, so this workflow does the following:
filterstep that usesdorny/paths-filterto figure out which application(s) have changedfilterstep to determine if the app needs to have its version incremented; tags are turned offI ended up having to do this on push, not on closed pull requests, because it was the only way I could get the commit comments (to control major/minor/patch logic).
Here’s the full workflow:
Note that the overall workspace version (and Git tag) will get updated even if a change doesn’t impact one of the applications. e.g. changing the
README.mdfile, which is at the workspace level, would cause the workspace version to increment (and a git tag), but not impact the version numbers of any of the applications.