After updating my pipeline today my changelog workflow failed with the following error:
Loading "/home/runner/work/github-actions/github-actions/.github/configs/conventional-commits/config.js" script
Error: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/github-actions/github-actions/node_modules/conventional-changelog-conventionalcommits/src/index.js from /home/runner/work/github-actions/github-actions/.github/configs/conventional-commits/config.js not supported.
Instead change the require of index.js in /home/runner/work/github-actions/github-actions/.github/configs/conventional-commits/config.js to a dynamic import() which is available in all CommonJS modules.
Troubleshooting
I began by trying to understand the nature of the error. I am by no means a JavaScript developer, so keep that in mind. As I understand it, some upstream dependency (I assumed conventional-changelog-conventionalcommits as it's the only thing I install) had changed. That change now requiring ESM rather than CommonJS... Either way I found that conventional-changelog recently updated from 7.0.2 -> 8.0.0. Searching through their changes I found https://github.com/conventional-changelog/conventional-changelog/pull/1237
Next I updated my local config.js to be what I believe is ESM friendly:
This change partially worked as I no longer received any errors, however the markdown came out wonky & the version bumper wasn't working. I presume the reason that the version bumper isn't working is because the new new Bumper exported class.
Expected behavior/outcome
Honestly, I wouldn't expect this to work given the nature of the changes. However, it might be worth mentioning version compatibilities somewhere in the documentation when using a custom Config-File-Path; as I managed to get it all working again when I pinned conventional-changelog-conventionalcommits to 7.0.2.
For now, I'll leave this in place until I see an update for this action.
It makes sense that it would stop breaking, the test file we have in the repo also still uses 7.0.2. Wil check when I have some time if we can update that to the latest version.
Platform
The issue
After updating my pipeline today my changelog workflow failed with the following error:
Troubleshooting
I began by trying to understand the nature of the error. I am by no means a JavaScript developer, so keep that in mind. As I understand it, some upstream dependency (I assumed
conventional-changelog-conventionalcommits
as it's the only thing I install) had changed. That change now requiring ESM rather than CommonJS... Either way I found that conventional-changelog recently updated from 7.0.2 -> 8.0.0. Searching through their changes I found https://github.com/conventional-changelog/conventional-changelog/pull/1237Next I updated my local config.js to be what I believe is ESM friendly:
->
This change partially worked as I no longer received any errors, however the markdown came out wonky & the version bumper wasn't working. I presume the reason that the version bumper isn't working is because the new new Bumper exported class.
Expected behavior/outcome
Honestly, I wouldn't expect this to work given the nature of the changes. However, it might be worth mentioning version compatibilities somewhere in the documentation when using a custom
Config-File-Path
; as I managed to get it all working again when I pinned conventional-changelog-conventionalcommits to7.0.2
.For now, I'll leave this in place until I see an update for this action.