conventional-changelog-action
conventional-changelog-action copied to clipboard
Global Exception handler seems to break on certain configs
v3.14.1 seems to include something that breaks existing flows. In this particular CI pipeline, i have an earlier checkout with
- uses: actions/checkout@v2
with:
fetch-depth: 0
so when it comes to this action, it will bail because the git config already exists. Odd thing is, it looks like it actually does go through all the steps of changelog generation, but then finally decides that something went wrong in the init steps, and then returns an error as exit code.
Using "chore(release): {version} [skip ci]" as commit message
Using "Conventional Changelog Action" as git user.name
Using "[email protected]" as git user.email
Using "1" release count
Using "./package.json" as version file
Using "version" as version path
Using "v" as tag prefix
Using "CHANGELOG.md" as output file
Using ".github/tools/changelog-config.js" as config file
Using "github.com" as gitUrl
Using "refs/pull/638/merge" as gitBranch
Skipping empty releases is "disabled"
Skipping the update of the version file is "enabled"
Loading "/home/runner/work/XXXXXX/.github/tools/changelog-config.js" script
/usr/bin/git config user.name Conventional Changelog Action
/usr/bin/git config user.email [email protected]
/usr/bin/git remote set-url origin ***github.com/XXXXX.git
error: could not lock config file .git/config: File exists
Unhandled Rejection occurred. Error: The process '/usr/bin/git' failed with exit code 255
at ExecState._setResult (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:592:25)
at ExecState.CheckComplete (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:575:18)
at ChildProcess.<anonymous> (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:469:27)
at ChildProcess.emit (events.js:[31](https://github.com/Solteq/xxxxx/actions/runs/3059089495/jobs/4936086371#step:6:32)4:20)
at maybeClose (internal/child_process.js:1022:16)
at Socket.<anonymous> (internal/child_process.js:[44](https://github.com/xxxxxactions/runs/3059089495/jobs/4936086371#step:6:45)4:11)
at Socket.emit (events.js:314:20)
at Pipe.<anonymous> (net.js:675:12)
Error: Unhandled Rejection occurred. Error: The process '/usr/bin/git' failed with exit code 255
at ExecState._setResult (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:592:25)
at ExecState.CheckComplete (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:575:18)
at ChildProcess.<anonymous> (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:[46](https://github.com/xxxxx/actions/runs/3059089495/jobs/4936086371#step:6:47)9:27)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1022:16)
at Socket.<anonymous> (internal/child_process.js:444:11)
at Socket.emit (events.js:314:20)
at Pipe.<anonymous> (net.js:675:12)
Recommended release type: patch
Because: static
Using GIT to determine the new version
I think this was always the case but in 3.14.1 we catch unhandled exceptions and markt he job failed.
Yeah, i think you are right it always happened.
But since i've set "dont-pull" and "dont-push", it feels like maybe this shouldnt be a failing condition that the git repo is already in the desired state
dont-pull
and dont-push
are not valid optons? Could you try with skip-git-pull
, this should prevent the initial pulling.
config used:
- name: Version
id: cleanchangelog
uses: TriPSs/conventional-changelog-action@v3
with:
config-file-path: .github/tools/changelog-config.js
github-token: ${{ secrets.ADMIN_TOKEN_GITHUB }}
release-count: '1'
skip-on-empty: 'false'
skip-git-pull: 'true'
skip-commit: 'true'
skip-version-file: 'true'
git-push: 'false'
Usecase here is a PR build, where i want to include the changelog in the build, but not actually push it back to the branch
Sorry for being unclear above, i was paraphrasing the various options
Could it be something you do in .github/tools/changelog-config.js
? As the error happens directly after that?
Unclear...
'use strict';
const config = require('conventional-changelog-angular');
config.then((x) => {
x.recommendedBumpOpts.whatBump = (commits) => {
// custom - we consider everything to be a patch
return {
level: 2,
reason: 'static',
};
};
});
module.exports = config;
Btw, i clipped a billion lines in the original output.
It ends like this:
New version: 1.26.24
/usr/bin/git tag -a v1.26.24 -m v1.26.24
We not going to push the GIT changes
0s
So it does seem to go through all the steps as expected.
Hmm, then I think gitSemverTags
is maybe causing this issue. Not quite sure how we can tackle this.
Is it possible that you share your whole workflow?
uhm, well, i can share the bit up to this point at least
on: pull_request
name: Pull Request Workflow
concurrency:
group: pr-${{ github.event.number }}
cancel-in-progress: true
jobs:
install:
runs-on: ubuntu-latest
env:
NPM_TOKEN_XX: ${{ secrets.XX }}
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/node-prepare
id: node-cache
- name: install if needed
if: ${{ steps.node-cache.outputs.cache-hit != 'true' }}
run: |
npm ci --prefer-offline --ignore-scripts true --audit false
npm run postinstall
build:
needs: install
runs-on: ubuntu-latest
env:
NPM_TOKEN_XX: ${{ secrets.NPM_TOKEN_XX }}
outputs:
versioninfo: ${{ steps.changelog.outputs.tag }}-${{ github.sha }}
deployinfo: ${{ github.event.number }}
changelog: ${{ steps.cleanchangelog.outputs.clean_changelog}}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/node-prepare
- name: Cache Build Artifacts for later jobs
id: artifactscache
uses: actions/cache@v2
with:
path: |
./dist/
key: artifacts-${{ github.sha }}
# pin version to whatever the PR says it is
- name: Version
id: changelog
run: |
currentversion=$(node -e "console.log(require('./package.json').version)")
echo "::set-output name=tag::v${currentversion}"
- name: Version
id: cleanchangelog
uses: TriPSs/[email protected]
with:
config-file-path: .github/tools/changelog-config.js
github-token: ${{ secrets.ADMIN_TOKEN_GITHUB }}
release-count: '1'
skip-on-empty: 'false'
skip-git-pull: 'true'
skip-commit: 'true'
skip-version-file: 'true'
git-push: 'false'
./.github/actions/node-prepare is just a composite action that runs
runs:
using: "composite"
steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.version }}
- uses: actions/cache@v3
id: node-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
But yeah, i agree that this has most likely been happening all the time. It just didnt matter, because
a) i got the changelog i wanted b) i didnt really want it to fiddle with the repo in any way c) it did not fail the build action
I checked the code, assuming that --skip-git-pull /push would essentially just disable the whole git manipulation, but i see now, that it changes the logic from being based on the version file, to being based on the git tags. So, maybe there isnt a good fix for this. Maybe this usecase is just crazy.
You could try one thing, but I don't think it will change anything: add:
env:
ENV: 'dont-use-git'
This will make sure that the git helper will never do anything.
If this does not work I would recommending pinning your version to v3.14.0
where the exception is still ignored. We could ofc also add a option that will let the action continue even though it fails.
Will try that. I can always just tell github actions to continue in case of errors, although that is a bit harsh.
I mostly brought it up, in case there was some unexpected behavior here, when using the actions on a repo that was already fully-fetched.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.