-
Notifications
You must be signed in to change notification settings - Fork 56
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
Darker GH action checks against HEAD commit -> no diff #260
Comments
Thanks @MatthijsBurgh for the report! I will return to this issue in the near future. |
I used a work-a-round: Then "master" is there and can be used for compare ;) |
This may be related to what @mayk0gan, @foxwhite25 and @jenshnielsen reported in comments for #264. Let's make sure those get fixed as well. |
Ok, by manually forcing darker So it is needed to do some git revision logic in the action. (Or include this in the library. But I would go for the first option.) As in my PR in my repo, I made changes that are not black(https://github.com/MatthijsBurgh/epydoc/pull/2/files#diff-26a8638e359a431fd5f8b5079abea3c6c6eaa4fc203fc95d8aa651ee66d88934R92) But the CI doesn't fail. (https://github.com/MatthijsBurgh/epydoc/runs/5138102045?check_suite_focus=true#step:3:7) |
@MatthijsBurgh The simplest is to use the |
@jenshnielsen Yes I know I can manually override the revision. But that would only solve the issue for me. I think it much better to include this logic in the action. So that everybody benefits from it. As for now the action is not really working out of the box. See my first comment (#260 (comment)) for the logic I use in my CI setup. Depending on the desired behaviour we could just copy that or need to modify it. |
In a feature branch centered workflow, I've found |
For pull request based runs it would seem to me that the environmental variable GITHUB_BASE_REF is the right thing to use. Documented here https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables |
I'd appreciate reviews of #282, @MatthijsBurgh @jedie @jenshnielsen. Would you accept an invitation as a collaborator on the Darker repository so I can assign you as reviewers? |
So @jenshnielsen you're saying |
Since |
Yes That seems good to me but I have not tested it yet. That is the pull request target. I have not thought a lot about the branch build |
To be honest, I didn't quite understand what the context is exactly with the |
Yes, that is fine. For reviewing and other small tasks, I am in. |
@akaihola Happy to be a collaborator. I left a non collaborator review now |
My opinion on what revision you should check: This should also be the logic from my CI(https://github.com/tue-robotics/tue-env/blob/master/ci/commit-range/action.yml). The logic resolving a empty commit range to |
#282 didn't fix the issue. |
@MatthijsBurgh I finally took a look at your tue-env/ci/commit-range/action.yml, and it looks really good. I couldn't find a license in that repository, so I can't just copy that code into a PR here. If you create that PR instead, I would think you'll then take the responsibility that you have the right to have your code distributed here under the 3-clause BSD license. |
I have created a PR to add a License to the |
Agree! |
tue-robotics/tue-env#604 seems to be merged now, so we can proceed! |
The Darker GitHub action is not working. As without specifying the revision argument, it checks against HEAD.
So in GH actions, it will always check against the current HEAD, which means the diff is always empty. Of course I could set up some custom logic to get the revision for a
push
orpull request
in my workflow. But it would be really helpful for everybody if would be included in the action.So the cases to consider in my opinion are just the push and PR events for now:
Push event: Get the diff compared to last run (on this branch)
PR event: Get the diff for the entire PR.
For my own CI, I have used the following logic, maybe you could use it: https://github.com/tue-robotics/tue-env/blob/master/ci/commit-range/action.yml (In case
COMMIT_RANGE
is empty, I go back toHEAD^
. This should only cause issues when HEAD is the first commit in the repo.)The text was updated successfully, but these errors were encountered: