Skip to content
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

Only check the HEAD commit of a PR #363

Closed
sonrohan opened this issue Mar 31, 2022 · 13 comments
Closed

Only check the HEAD commit of a PR #363

sonrohan opened this issue Mar 31, 2022 · 13 comments

Comments

@sonrohan
Copy link

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

@jdbruijn
Copy link
Collaborator

jdbruijn commented Apr 1, 2022

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!

@sonrohan
Copy link
Author

sonrohan commented Apr 1, 2022

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

@jdbruijn
Copy link
Collaborator

jdbruijn commented Apr 1, 2022

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 😉

@jdbruijn jdbruijn changed the title Feature request Only check the HEAD commit of a PR Apr 1, 2022
@sonrohan
Copy link
Author

sonrohan commented Apr 1, 2022

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

@wagoid
Copy link
Owner

wagoid commented Apr 6, 2022

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 💪

@jdbruijn
Copy link
Collaborator

jdbruijn commented Apr 7, 2022

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

@Sakethtadimeti
Copy link
Contributor

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

@wagoid
Copy link
Owner

wagoid commented Nov 17, 2022

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!

@Sakethtadimeti
Copy link
Contributor

Sakethtadimeti commented Nov 19, 2022

@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.

@wagoid
Copy link
Owner

wagoid commented Nov 19, 2022

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

@Sakethtadimeti
Copy link
Contributor

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

@SvenStaehs
Copy link

the PR is merged, can the issue be closed?

@Sakethtadimeti
Copy link
Contributor

the PR is merged, can the issue be closed?

Sure 😃

@wagoid wagoid closed this as completed Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants