-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[10217] Run newsfragment checks based on the exact branch code, not the to-be-merged code. #1617
Conversation
|
This is ready for review. I am not sure what are the side effects for not running pyflakes check on the to-be-merged code. Ideally for the release branch we want to run on You can create something like but then the same commit will be execute for both push and pull_request ...with conflicting results. You can see a failed PR test run for a release branch here https://github.com/twisted/twisted/runs/3000559343#step:5:89 branch name is but newsfragmentcheckers thinks that this is not a release branch |
|
Won't this not build for out-of-repo PRs? I mean yeah, it's a mess that GitHub defaults to checking out the automatic merge commit, but there's an option for that. Though it still uses the automatic merge commit for at least the initial (if not all) workflow definition. |
True. Thanks for the feedback. Maybe have something like this and skip the pull_request run for a release branch. I will see what can be done. |
|
One crazy idea. On GitHub Action detect that the job is executed for a pull_request and revert the last commit and run the newsfragment check. |
d377259
to
eeb00c1
Compare
|
Thanks for the review and feedback. I reverted the change so that we will have the checks executed on a pull_request event... to have it executed for external forks. But for a release branch (a branch starting with You can see the merge reverting code here on a release branch: https://github.com/twisted/twisted/pull/1614/checks?check_run_id=3022301290#step:5:11 |
|
Are you sure you don't want to just always checkout the not-merged commit? docs: https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit - uses: actions/checkout@v1
with:
ref: ${{ github.event.pull_request.head.sha }}You may also want a more complete checkout for the newsfragment check so that towncrier can actually see the other branch. docs: https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches - uses: actions/checkout@v2
with:
fetch-depth: 0Hopefully I'm going down a useful path here... |
Good question... but yes I want to run as many checks as possible based on the to-be-merged code. And only run newsfragment checks on the non-merged code. I think that for pyflakes and other checks we want to check the merged code as this is what will be committed and we don't want to risk introducing errors in trunk. And I think that for a release branch, we also want to run pyflakes on the merge code just to prevent any strange errors to be triggered after the release branch is merged. So, unless there are any major unwanted side-effects I would prefer to merge this code as it is. If found out that this is a bad idea, we can always update it. But for now, I don't see why the current code is a bad idea :) Thanks for the review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still prefer just directly checking out the pushed code as mentioned in #1617 (comment), but this seems like it will work.
To put some extra commentary here (I already discussed this with Adi on IRC), I consider GitHub's checking out of an automatically generated merge commit to be pretty darn bad. The common argument for it is that "then the PR build shows what it would do if merged". Except that that is untrue as soon as a new commit is added to the PR's target branch. Remember, the PR isn't rebuilt then, it just sits there claiming to be happy as long as an automatic merge can be done. So, you just have this idea in your head that the PR build is representative when it isn't. The actual solution to getting close to knowing the PR build is representative of what the post-merge build will be is to require that PRs be up to date with their target branches (which we do, I believe). The remaining differences are any build mechanisms that check the actual branch or trigger info etc.
Probably worth re-investigating if GHA ever supports merge trains |
|
Thanks for your feedbacks. I have merged it as I wanted to have a green release branch. I think that we can re-consider at any time the way we run the static checks. |
Scope and purpose
The main reason for doing that is so that newsframent will be executed on the exact branch code and to avoid errors generated on the release branch.
The GitHub
pull_requestevents are executed on a to-be-merged branch that does not has the same name as the tested branch, and the newsfragment checker fails to detect it as a release branch.And when trunk contains features are are not to be released yet, the merge branch will contain those release fragments from trunk and the check fill fail as the release branch should have no release fragments.
Contributor Checklist:
tox -e lintto format my patch to meet the Twisted Coding Standard#character).reviewto the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.The first line is automatically generated by GitHub based on PR ID and branch name.
The other lines generated by GitHub should be replaced.