-
-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathwebsite-pr.mjs
More file actions
37 lines (33 loc) · 848 Bytes
/
website-pr.mjs
File metadata and controls
37 lines (33 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Octokit } from "@octokit/action"
import github from "@actions/github"
import { BASE_BRANCH } from "./params.mjs"
const octokit = new Octokit({})
console.log("Find existing PR")
const { data: prs } = await octokit.pulls.list({
...github.context.repo,
state: "open",
base: "main",
head: `${github.context.repo.owner}:${BASE_BRANCH}`,
})
console.log("Existing PRs", prs)
const title = `✨ Update website ✨`
const body = ""
if (prs.length === 0) {
console.log("Creating new PR")
await octokit.rest.pulls.create({
...github.context.repo,
base: "main",
head: BASE_BRANCH,
title,
body,
})
} else {
// console.log("Updating existing PR")
// const { number } = prs[0]
// await octokit.rest.pulls.update({
// ...github.context.repo,
// pull_number: number,
// title,
// body,
// })
}