Commit 2900238
committed
TECH_DEBT: Resolve short commit hashes via the GitHub commits API
get_deployed_commit.py read the full SHA from payload.commit.sha2 in the JSON served
by the GitHub commit page. That path no longer exists — the SHA moved to
payload.commitRoute.commit.oid — so the chained .get() calls fell back to the short
hash and returned it without raising. The "Attempting to translate..." line was
therefore followed by neither a warning nor a translation.
FromCommit then reached list-deploy-changes.py as a 7-character hash. It fetches both
refs with 'git fetch --depth=1 origin <ref>', which GitHub rejects for anything but a
full SHA ("couldn't find remote ref"), and that fetch discards stderr and ignores its
exit code, so the deployment summary could silently come out empty.
- Query api.github.com/repos/.../commits/<sha> with the 'application/vnd.github.sha'
media type, which returns the 40-character hash as plain text, instead of reading
the commit page's undocumented JSON payload
- Accept the result only when it is exactly 40 characters, warning with the response
body otherwise
- Warn explicitly when FromCommit is still a short hash, naming the fetch that will
fail, so a future breakage is not silent
Verified against qa and qa2: 78b98b4 now resolves to
78b98b4. An unknown hash returns HTTP 422, which
raises into the existing handler and then trips the short-hash warning.1 parent 9cc26af commit 2900238
1 file changed
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
108 | | - | |
| 109 | + | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | | - | |
112 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
116 | 129 | | |
117 | 130 | | |
118 | 131 | | |
| |||
0 commit comments