Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. GET https://api.github.com/repos/:owner/:repo/git/refs/heads/:branch
  2.  
  3. https://api.github.com/repos/izuzak/pmrpc/git/refs/heads/master
  4.  
  5. {
  6. "ref": "refs/heads/master",
  7. "url": "https://api.github.com/repos/izuzak/pmrpc/git/refs/heads/master",
  8. "object": {
  9. "sha": "fd6973f430a3367ad718ff049f1b075843913d6f",
  10. "type": "commit",
  11. "url": "https://api.github.com/repos/izuzak/pmrpc/git/commits/fd6973f430a3367ad718ff049f1b075843913d6f"
  12. }
  13. }
  14.  
  15. GET https://api.github.com/repos/izuzak/pmrpc/git/commits/fd6973f430a3367ad718ff049f1b075843913d6f
  16.  
  17. {
  18. "sha": "fd6973f430a3367ad718ff049f1b075843913d6f",
  19. "url": "https://api.github.com/repos/izuzak/pmrpc/git/commits/fd6973f430a3367ad718ff049f1b075843913d6f",
  20. "html_url": "https://github.com/izuzak/pmrpc/commits/fd6973f430a3367ad718ff049f1b075843913d6f",
  21. "author": {
  22. "name": "Ivan Zuzak",
  23. "email": "izuzak@gmail.com",
  24. "date": "2013-04-09T08:55:45Z"
  25. },
  26. "committer": {
  27. "name": "Ivan Zuzak",
  28. "email": "izuzak@gmail.com",
  29. "date": "2013-04-09T08:55:45Z"
  30. },
  31. "tree": {
  32. "sha": "f5f5de80f67dd794ffbd4abb855fb7d1a573660e",
  33. "url": "https://api.github.com/repos/izuzak/pmrpc/git/trees/f5f5de80f67dd794ffbd4abb855fb7d1a573660e"
  34. },
  35. "message": "fix typos",
  36. "parents": [
  37. {
  38. "sha": "d3617ae56dda793131e743b2ff394984bbab6ca3",
  39. "url": "https://api.github.com/repos/izuzak/pmrpc/git/commits/d3617ae56dda793131e743b2ff394984bbab6ca3",
  40. "html_url": "https://github.com/izuzak/pmrpc/commits/d3617ae56dda793131e743b2ff394984bbab6ca3"
  41. }
  42. ]
  43. }
  44.  
  45. GET https://api.github.com/repos/izuzak/pmrpc/git/trees/f5f5de80f67dd794ffbd4abb855fb7d1a573660e
  46.  
  47. {
  48. "sha": "f5f5de80f67dd794ffbd4abb855fb7d1a573660e",
  49. "url": "https://api.github.com/repos/izuzak/pmrpc/git/trees/f5f5de80f67dd794ffbd4abb855fb7d1a573660e",
  50. "tree": [
  51. {
  52. "mode": "100644",
  53. "type": "blob",
  54. "sha": "726f21a4adec8c24c2fab6cf5b455d094a8b21bf",
  55. "path": "LICENSE.markdown",
  56. "size": 568,
  57. "url": "https://api.github.com/repos/izuzak/pmrpc/git/blobs/726f21a4adec8c24c2fab6cf5b455d094a8b21bf"
  58. },
  59. {
  60. "mode": "100644",
  61. "type": "blob",
  62. "sha": "eb94760b81441b34a73d1b085d9f153ae48b0e63",
  63. "path": "README.markdown",
  64. "size": 5772,
  65. "url": "https://api.github.com/repos/izuzak/pmrpc/git/blobs/eb94760b81441b34a73d1b085d9f153ae48b0e63"
  66. },
  67. {
  68. "mode": "040000",
  69. "type": "tree",
  70. "sha": "2e72b217b8644ce6874cda03387a7ab2d8eee55e",
  71. "path": "examples",
  72. "url": "https://api.github.com/repos/izuzak/pmrpc/git/trees/2e72b217b8644ce6874cda03387a7ab2d8eee55e"
  73. },
  74. {
  75. "mode": "100644",
  76. "type": "blob",
  77. "sha": "64b0dbe4981759c0f9640c8e882c97c7324fc798",
  78. "path": "pmrpc.js",
  79. "size": 24546,
  80. "url": "https://api.github.com/repos/izuzak/pmrpc/git/blobs/64b0dbe4981759c0f9640c8e882c97c7324fc798"
  81. }
  82. ]
  83. }
  84.  
  85. GET https://api.github.com/repos/izuzak/pmrpc/git/trees/2e72b217b8644ce6874cda03387a7ab2d8eee55e
  86.  
  87. GET https://api.github.com/repos/:user/:repo/commits?path=FILE_OR_FOLDER_PATH
  88.  
  89. GET https://api.github.com/repos/izuzak/pmrpc/commits?path=examples
  90.  
  91. [
  92. {
  93. "sha": "3437f015257683a86e3b973b3279754df9ac2b24",
  94. "commit": {
  95. "author": { ... },
  96. "committer": { ... },
  97. "message": "change mode",
  98. "tree": { ... },
  99. "url": "https://api.github.com/repos/izuzak/pmrpc/git/commits/3437f015257683a86e3b973b3279754df9ac2b24",
  100. "comment_count": 0
  101. },
  102. ...
  103. },
  104. {
  105. ...
  106. }
  107. ]
  108.  
  109. func GetLatestCommit(owner, repo string, sgc *github.Client) (string, error) {
  110. commits, res, err := sgc.Repositories.ListCommits(owner, repo, &github.CommitsListOptions{})
  111.  
  112. if err != nil {
  113. log.Printf("err: %s res: %s", err, res)
  114. return "", err
  115. }
  116.  
  117. log.Printf("last commit: %s", *commits[0].SHA)
  118.  
  119. return *commits[0].SHA, nil
  120. }
  121.  
  122. <a href="/luckydonald/JavaPipBoyServer/blob/a6f4038336ff41463ad527b4ff4fda45642ebc6d/PROTOCOL.md" class="d-none js-permalink-shortcut" data-hotkey="y">Permalink</a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement