1 | type Github = { |
2 | token: string; |
3 | }; |
4 | |
5 | * Move a project column |
6 | * |
7 | */ |
8 | export async function main( |
9 | auth: Github, |
10 | column_id: string, |
11 | body: { position: string; [k: string]: unknown } |
12 | ) { |
13 | const url = new URL( |
14 | `https://api.github.com/projects/columns/${column_id}/moves` |
15 | ); |
16 |
|
17 | const response = await fetch(url, { |
18 | method: "POST", |
19 | headers: { |
20 | "Content-Type": "application/json", |
21 | Authorization: "Bearer " + auth.token, |
22 | }, |
23 | body: JSON.stringify(body), |
24 | }); |
25 | if (!response.ok) { |
26 | const text = await response.text(); |
27 | throw new Error(`${response.status} ${text}`); |
28 | } |
29 | return await response.json(); |
30 | } |
31 |
|