-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use it in Github Actions? #7
Comments
You can see the configuration in this repo https://github.com/hyiso/commitlint/blob/main/.github/workflows/pr_title.yml |
That only validates the PR title but I can't get it working with the commit range of the PR |
I've added a Github Action in this repo and created a PR to test it #8. From The Action Running Log, the problem happened during getting commit messages in Github Action Runner, which seems to be not related to this package: commitlint:read - from = main, to = feature/validate-pr-commit, edit = null
commitlint:read - git log --format=%B main..feature/validate-pr-commit
commitlint:read - stdout =
commitlint:read - stderr = fatal: ambiguous argument 'main..feature/validate-pr-commit': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]' |
Thanks for the investigation. Can we still try to fix it here? I already tried things like fetching the whole repo or pulling the main branch etc. |
Can you try - uses: actions/checkout@v3
with:
fetch-depth: 0 |
After several tries, the following configuration works finally: uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
...
dart run commitlint_cli --from="origin/${{ github.base_ref }}" --to="${{ github.head_ref }}" You can see the log https://github.com/hyiso/commitlint/actions/runs/5560955537/jobs/10158300171?pr=8 The important parts are checkout with |
Thanks a lot! I'll try it out on my repo. I think |
Ok I was wrong, you need to set |
It works, but if someone creates a PR from a fork then it doesn't work because the branch can't be found :/ |
Fix #7 PR from fork repo see nextcloud/neon#481
❤️ |
Hi, I'm trying to use commitlint in Github Actions to validate commit messages in the CI. For some reason I can't get it to fail when it should. The current workflow is at nextcloud/neon@a32ce68. I was able to get it working locally with https://github.com/nektos/act when using
--from=main --to=@
, but that also didn't work on Github Actions. Can someone help me get this working? I'm not sure if the workflow is the problem or if there is a bug in this tool.The text was updated successfully, but these errors were encountered: