pytorch/.github
Huy Do 345714e372 Upload merge records to Rockset (#97471)
This upload a record to a new Rockset `merges` collection in `commons` workspace in the following format:

```
{
    "id": comment_id,
    "pr_num": pr_num,
    "owner": owner,
    "project": project,
    "pending_checks": pending_checks,  # At the time of the merge
    "failed_checks": failed_checks,  # At the time of the merge
    "is_failed": is_failed,  # This is set to True if the merge fails to get through for whatever reason
    "dry_run": dry_run,
    "skip_mandatory_checks": skip_mandatory_checks,
    "ignore_current": ignore_current,
    "error": error,  # The same Exception message that will be shown on PR
}
```

To achieve this, I need to tweak `find_matching_merge_rule` a bit to return the list of pending and failed checks in addition to the matching merge rule.  As this function is also used internally, I have confirmed that the internal call doesn't need the return values.  Thus, the change is safe to land.

### Testing

* Unit testing
* Dry-run locally `python3 .github/scripts/trymerge.py --comment-id 1478678477 --dry-run 97293` using an older PR.  The merge obviously failed, but the record was created successfully on Rockset
```
{
  "_id": "52d3152b-ec35-4b5a-91fc-0e7298fc54b5-1",
  "_event_time": "2023-03-23T21:10:32.754368Z",
  "_meta": null,
  "owner": "pytorch",
  "is_failed": true,
  "id": 1478678477,
  "failed_checks": [],
  "dry_run": true,
  "error": "Command `git -C pytorch cherry-pick -x cc0d2e0fba648bb5deda34a9056f2c4192b22314` returned non-zero exit code 1...",
  "ignore_current": false,
  "project": "pytorch",
  "pr_num": 97293,
  "skip_mandatory_checks": false,
  "pending_checks": []
}
```

* Dry-run locally with this PR `python3 .github/scripts/trymerge.py --comment-id 1481949104 --dry-run --force 97471` with `--force`
```
{
  "_id": "dd7d2580-f6e5-47e7-9441-17df86056c14-1",
  "_event_time": "2023-03-23T21:43:53.915911Z",
  "_meta": null,
  "owner": "pytorch",
  "is_failed": true,
  "id": 1481949104,
  "failed_checks": [],
  "dry_run": true,
  "error": "PR #97471 has not been reviewed yet",
  "ignore_current": false,
  "project": "pytorch",
  "pr_num": 97471,
  "skip_mandatory_checks": true,
  "pending_checks": []
}
```

* Dry-run locally with this PR `python3 .github/scripts/trymerge.py --comment-id 1481949104 --dry-run 97471` again with approval rule commented out

```
{
  "_id": "5d7de4e3-1af1-4869-a3b7-d1a9dbced6ce-1",
  "_event_time": "2023-03-24T00:10:41.914111Z",
  "_meta": null,
  "is_failed": false,
  "id": 1481949104,
  "failed_checks": [],
  "error": "",
  "last_commit_sha": "4657400513f0360a0a4f73d46e1aff0882221687",
  "merge_commit_sha": "416bac5b813a181753afade781ae30f4f0843586",
  "ignore_current": false,
  "pending_checks": [
    [
      "pull / linux-focal-py3.8-gcc7 / test (default, 1, 3, linux.2xlarge)",
      "https://github.com/pytorch/pytorch/actions/runs/4506464828/jobs/7933518379",
      12239935788
    ],
    ...
    [
      "trunk / linux-bionic-cuda11.8-py3.10-gcc7 / test (default, 5, 5, linux.4xlarge.nvidia.gpu)",
      "https://github.com/pytorch/pytorch/actions/runs/4506465633/jobs/7933621958",
      12240067113
    ],
    ...
  ],
  "owner": "pytorch",
  "skip_mandatory_checks": true,
  "author": "Huy Do <huydhn@gmail.com>",
  "project": "pytorch",
  "merge_base_sha": "a3b30c5025e3381022fa00b127b0d881f4ef66d4",
  "pr_num": 97471
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97471
Approved by: https://github.com/clee2000
2023-03-27 18:42:00 +00:00
..
actions Re-enable test_ops_jit on Windows (#96859) (#96931) 2023-03-17 22:42:22 +00:00
ci_commit_pins [vision hash update] update the pinned vision hash (#97396) 2023-03-23 04:14:58 +00:00
ISSUE_TEMPLATE Add an issue template to disable CI jobs (#97045) 2023-03-22 20:32:35 +00:00
requirements Remove pytest block list (#96698) 2023-03-16 04:22:42 +00:00
scripts Upload merge records to Rockset (#97471) 2023-03-27 18:42:00 +00:00
templates Add new checks in CI system to verify the built linux pip wheel with cpu-cxx11-abi (#79409) 2023-02-14 12:59:03 +00:00
workflows [CI] Reduce perf nightly run frequency and bump up its timeout limit (#97682) 2023-03-27 17:22:02 +00:00
actionlint.yaml Switch Windows CI jobs to G5 runners (#91727) 2023-01-13 01:11:59 +00:00
auto_request_review.yml Remove chhillee from autoreview (#97293) 2023-03-22 03:45:43 +00:00
ISSUE_TEMPLATE.md
labeler.yml Autorun binary builds when a commit pin is updated (#96526) 2023-03-13 18:33:29 +00:00
merge_rules.yaml Add autocast_test_lists.py to the merge patterns (#94381) 2023-03-23 01:56:02 +00:00
PULL_REQUEST_TEMPLATE.md [BE] Extend linter to detect DOS newlines (#86973) 2022-10-15 00:20:42 +00:00
pytorch-circleci-labels.yml
pytorch-probot.yml Remove inductor-perf-test-nightly label (#97290) 2023-03-24 01:02:29 +00:00
regenerate.sh
requirements-gha-cache.txt Update lintrunner to version that uses as default mergebase (#95938) 2023-03-07 20:25:02 +00:00