semantic-release / semantic-release/git
Suggestion - Documentation & new option around commit hook
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 339
- Forks
- 75
- Avg merge
- 5h 15m
- Merged PRs (30d)
- 6
Description
- Version:
10.0.1 - Node:
v18.18.2
We're using this plugin which is awesome. Recently we got an error when running semantic-release in our pipeline that took us a while to figure out.
[semantic-release] › ✘ Failed step "prepare" of plugin "@semantic-release/git"
[semantic-release] › ✘ An error occurred while running semantic-release: Error: Command failed with exit code 1: git commit -m chore(release): <version number> [skip ci]
We are using Husky, but that's disabled in the pipeline. There was a log at the bottom regarding our unit tests which I thought was a result of the job failing. This was an incorrect assumption. It was because our unit tests were being run due to the plugin and there was missing a build file. I was unaware until I looked at the source code that this plugin would run our git commit hook (which now feels obvious). Before putting in a PR I wanted to open a ticket with my suggestions;
- Update
README.mdso its clear if you have a git commit hook it will be ran - Provide an option to add the
--no-verifyflag to the commit function - Add some logging for when a commit hook runs, finishes and if it fails
I'm unsure how to do the 3rd option but something like the below I feel would work.
async function commit(message, execaOptions, noVerify = false) {
const gitArgs = ['commit', '-m', message];
// Add --no-verify flag if noVerify is true
if (noVerify) {
gitArgs.push('--no-verify');
}
try {
console.log('Running git commit');
await execa('git', gitArgs, execaOptions);
console.log('Commit successful.');
} catch (error) {
console.error('Error during git commit:', error);
throw error; // Rethrow the error to handle it outside this function if needed
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with README.md and the commit function in lib/git.js around the linked line to trace how semantic-release invokes git commit and its hooks. Define the requested no-verify option and hook logging behavior, then update the documentation so hook execution is explicit; done means all three requested changes are covered consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, javascript
- Domain
- release, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100