-
Notifications
You must be signed in to change notification settings - Fork 24
Discussion: custom configuration #1
Comments
I rolled this around a bit already here are my thoughts:
cc @paulirish |
@marionebl Thank you for sharing this
I have no idea what |
Whoops, I meant commitlint, referring to the feature of cosmiconfig where config is read from a section in package.json |
I do not have a good solution for making this work with things like commitlint-config-lerna though without cloning the repository. |
I understand correctly now.sh is the primary deployment target for probot? |
I think a command line approach ( like how bundlesize works) may fits things like
I may only use now.sh - at least for now. Other services are forbidden in my country :/ |
Here is a another approach:
What do you think? |
Sounds like a very good idea! This would require json formatted output for commitlint and some tool to manage the transport to commitlint-bot right? |
I'd add the complete resolved config to the json output. This way we could even cover @paulirish's use case of linting the PR title, using said resolved config from CI runs to check on title changes indicated by web hooks. |
yo guys! haha it's another commitlint bot! :D my project is, yah, only focused on the PR title and doesn't care about commits. As such, it wouldn't make sense to be a CLI that runs inside of CI (like codecov or bundlesize). Because a user needs to iterate on the PR title a few times to get it right.. so it needs to be webhook. In mine, I pull the |
@paulirish umm, it may not work for |
It may also limit the possible supported scenarios? However, you're right, running inside a CI wouldn't make sense if the user only wants title linting |
I think we can have the cake and eat it, too - by taking up @ahmed-taj's idea to send information from CI to commitlint-bot. I propose to not lint on CI, but let commitlint send the resolved config for a CI run to commitlint-bot. Step by step this would work like this: 1. Linting a PR title
2. Linting a PR commit range
On a side note: Would it make sense to check the current merge strategy of a PR (if possible) and automatically do the right thing, e.g.:
|
@marionebl sounds very good 👍 , I think I will go with your proposal! I will try to work on this in the next couple of days. Will open a WIP pull request.
AFAIK, GitHub doesn't provide an API for this, yet! |
Oh, that needs an option in @marionebl you can point me where to start to add this functionality to |
@ahmed-taj Yeah, we'll have to add this as subcommand to commitlint/cli, e.g.: commitlint config --resolve --json # machine output
commitlint config --resolve # human readable output, let's implement later Just before @commitlint/cli/src/cli.js#L80 something like this could go: const configCommand = require('./commands/config');
const defaultCommand = require('./commands/default');
async function main(options) {
const raw = options.input;
const command = raw.length > 1 ? raw[0] : null;
// ...
switch(command) {
case 'config':
return configCommand(options);
default:
return defaultCommand(options);
}
} |
@ahmed-taj I noticed you went ahead and forked commitlint. Don't hesitate to contact me if you hit road blocks or just could do with some help. Ping me e.g. on the commitlint channel in the devtools slack: |
Hey @marionebl I appreciate it :) Sadly, I can no longer use Slack But I can open a work-in-progress pull request in your commitlint repo so we may continue discussion there |
Ok, that's a bummer. What Messengers do you use? I am e.g. on Gitter. Can make IRC happen too. |
Gitter sounds good, which channel? |
I published a pre-release of the required
Invoking
|
Great work @marionebl
Plain So, about the |
I think the next step is to fully resolve the configs, so we end up having no need for |
Yep, sorry about that - I edited my comment to reflect this.
The config actually is fully resolved (the extensions are expanded into .rules), the |
Great! I may just ignore We now have the "cake", let's eat it ;) |
I think I start the logic on the bot side the next couple of days (when I have a final idea on how to "authorize" the upload request) |
reading from |
@ahmed-taj I can help if needed to run untrusted JS code on Node, as the If the code does not contain any |
A bit of a flyer, but how about a commitlint github action that just runs commitlint cli in the repo? |
@bennypowers Yeah, that would be awesome. I think about making one but didn't get early access to Github Actions yet. |
See https://github.com/bennypowers/commitlint-gh-actions (untested.. not even sure if it will run) and conventional-changelog/commitlint#586 |
I've created a github action for this case, if you want to have a look: https://github.com/marketplace/actions/commit-linter I tried using @bennypowers's action but got some issues and ended up creating another one, as explained here. This one was made to not depend on the project's stack, so it comes with a set of shared configs available to use. The downside is that people can't use configs that come from a private npm package, but I think this is way less likely to happen. If someone needs that case, we can also create another commitlint action that depends on context (or maybe update Benny's one to do that). |
Thanks @wagoid for publishing. Happy to take PRs, as I've not had the time to invest in this recently. |
I would like to discuss what things I need to consider when supporting custom configuration files in the root repository directory.
More specifically, how can we support
.commitlint.yml
or.commitlint.json
? I can't see any way to support.js
based config filesAny input is welcome!
cc @marionebl
The text was updated successfully, but these errors were encountered: