<div dir="ltr">That's great! This is so nice and easy, much simpler than I thought it was going to be! Being able to do this fully local is a wonderful simplification -- and can easily get us the minimal checks that we wanted as a prerequisite.<div><br></div><div>Longer-term, I think we will still probably want to push the commit somewhere prior to commit so that we can automatically run hosted presubmit checks (e.g. running builds on a build-farm), but we can consider that separately.</div><div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 15, 2019 at 11:52 PM Tom Stellard via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 04/13/2019 05:13 PM, Mehdi AMINI wrote:<br>
> <br>
> <br>
> On Sat, Apr 13, 2019 at 4:47 PM Mehdi AMINI <<a href="mailto:joker.eph@gmail.com" target="_blank">joker.eph@gmail.com</a> <mailto:<a href="mailto:joker.eph@gmail.com" target="_blank">joker.eph@gmail.com</a>>> wrote:<br>
> <br>
> <br>
> <br>
>     On Tue, Apr 9, 2019 at 12:39 AM David Chisnall via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>>> wrote:<br>
> <br>
>         On 09/04/2019 00:32, Tom Stellard via cfe-dev wrote:<br>
>         > As a backup plan, I am going to look into implementing option #1, but instead<br>
>         > of having git-llvm create a pull request, it would push first to a staging<br>
>         > branch and then push to master if a 'no-merge commit' status checks pass.  This<br>
>         > is essentially the same flow as using pull requests, but without all the<br>
>         > pull request noise.<br>
> <br>
>         I don't think that you can enforce this policy on the server side.  You<br>
>         could; however, make git-llvm create a pull request and, if the relevant<br>
>         checks pass, automatically use the GitHub APIs to do a rebase and merge.<br>
> <br>
> <br>
>     I believe you can with: <a href="https://help.github.com/en/articles/enabling-required-status-checks" rel="noreferrer" target="_blank">https://help.github.com/en/articles/enabling-required-status-checks</a><br>
> <br>
>     I don't even think you need to push a branch for this*, the git-llvm script should be able to perform the required check locally, then issue a REST call and push to master.<br>
> <br>
> <br>
> I just double-checked (I created a fake "rebased" check on my repo) and it still works as expected:<br>
> <br>
> $ git push<br>
> Enumerating objects: 5, done.<br>
> Counting objects: 100% (5/5), done.<br>
> Writing objects: 100% (3/3), 270 bytes | 270.00 KiB/s, done.<br>
> Total 3 (delta 0), reused 0 (delta 0)<br>
> remote: error: GH006: Protected branch update failed for refs/heads/master.<br>
> remote: error: Required status check "rebased" is expected.<br>
> To github.com:joker-eph/test_required_check.git<br>
>  ! [remote rejected] master -> master (protected branch hook declined)<br>
> error: failed to push some refs to 'git@github.com:joker-eph/test_required_check.git'<br>
> <br>
> The `git llvm push` script could very well rebase, check the absence of merge commit, and issue this REST call:<br>
> <br>
> $ curl   --user "{GitHub_username}"   -H "Authorization: token {GitHub token}"  <a href="https://api.github.com/repos/joker-eph/test_required_check/statuses/$(git" rel="noreferrer" target="_blank">https://api.github.com/repos/joker-eph/test_required_check/statuses/$(git</a> <<a href="https://api.github.com/repos/joker-eph/test_required_check/statuses/$%28git" rel="noreferrer" target="_blank">https://api.github.com/repos/joker-eph/test_required_check/statuses/$%28git</a>> rev-list HEAD -n 1)  -X POST --data '{"state": "success", "context": "rebased" }'<br>
> <br>
<br>
Ok, this would be much better than what I was proposing.  Thanks<br>
for figuring this out.<br>
<br>
-Tom<br>
<br>
> After which the push is passing:<br>
> <br>
> $ git push<br>
> Enumerating objects: 5, done.<br>
> Counting objects: 100% (5/5), done.<br>
> Writing objects: 100% (3/3), 270 bytes | 270.00 KiB/s, done.<br>
> Total 3 (delta 0), reused 0 (delta 0)<br>
> To github.com:joker-eph/test_required_check.git<br>
>    a07ce8f..2dd24ba  master -> master<br>
> <br>
> -- <br>
> Mehdi<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>