wagoid / commitlint-github-action

Lints Pull Request commits with commitlint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only check the HEAD commit of a PR

sonrohan opened this issue · comments

Could we add a flag that only checks the head commit of the feature branch on PR?

If I have a branch like this

TICKET-123 Do some work
fix x
fix y
add unit test

I want this to only run on TICKET-123 Do some work

I'm not quite sure, but I think you could already achieve that by setting fetch-depth: 1 in the checkout action, don't configure it as 1 is the default. The way this action works is by getting the git commit information from the local environment, so if you only fetch a single commit we'd run on just that (I think). Please let me know if that resolves your issue!

Thanks for the quick response! Actually tried to change the fetch depth to 1 and also even tried 2, and it threw some errors. I'm on my phone right now so I don't have them, but I can update this comment later with the relevant error. It didn't seem to worth though is the tldr

Ah yeah, I guess you're right. In the PR we'll get a commit SHA range from GitHub, so we'll try to run on that range. In the case fetch-depth: 1 however, not all commits we'd need are available and you get an error (see #340). Then this is a valid feature request and I'll leave it up to @wagoid to decide what to do with it 😉

Thanks! If you need someone to contribute this to the codebase I'm happy to take a crack at it. Just let me know.

Hey @sonrohan! That seems like a nice feature. @jdbruijn your comment made me wonder if we should support a similar fetch-depth param in the action? So if we pass fetch-depth: 1 to our action it would analyze only the HEAD commit in the end.

Thanks! If you need someone to contribute this to the codebase I'm happy to take a crack at it. Just let me know.

@sonrohan thanks! I would be happy to review it 💪

Yeah I think we should name it commit-depth or something like that to avoid confusion with the checkout parameter.

Folks, is this closed?
I have a similar use case to only test against the latest commit.

Hi @Sakethtadimeti, the issue is still open. I won't be able to work on it in the near future, but happy to review any PRs!

@wagoid Please provide write access.

ERROR: Permission to wagoid/commitlint-github-action.git denied to Sakethtadimeti.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

@Sakethtadimeti you will need to create a fork of the repo, then submit a pull request.

Hey @wagoid, please have a look at this PR #595.
Many thanks for considering my request.

the PR is merged, can the issue be closed?

the PR is merged, can the issue be closed?

Sure 😃