File tree 3 files changed +71
-0
lines changed
3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ For every push to `next`:
47
47
- labels: `release`
48
48
```
49
49
50
+ ```
51
+ - create a PR from 'next' to 'main' if it doesn't exist
52
+ - title: Update website
53
+ ```
54
+
50
55
## release-pr-merged
51
56
52
57
for every ` release ` pr merged to ` next ` :
Original file line number Diff line number Diff line change
1
+ import { Octokit } from "@octokit/action"
2
+ import github from "@actions/github"
3
+ import { BASE_BRANCH } from "./params.mjs"
4
+
5
+ const octokit = new Octokit ( { } )
6
+
7
+ console . log ( "Find existing PR" )
8
+ const { data : prs } = await octokit . pulls . list ( {
9
+ ...github . context . repo ,
10
+ state : "open" ,
11
+ base : "main" ,
12
+ head : `${ github . context . repo . owner } :${ BASE_BRANCH } ` ,
13
+ } )
14
+ console . log ( "Existing PRs" , prs )
15
+
16
+ const title = `✨ Update website ✨`
17
+ const body = ""
18
+
19
+ if ( prs . length === 0 ) {
20
+ console . log ( "Creating new PR" )
21
+ await octokit . rest . pulls . create ( {
22
+ ...github . context . repo ,
23
+ base : "main" ,
24
+ head : BASE_BRANCH ,
25
+ title,
26
+ body,
27
+ } )
28
+ } else {
29
+ // console.log("Updating existing PR")
30
+ // const { number } = prs[0]
31
+ // await octokit.rest.pulls.update({
32
+ // ...github.context.repo,
33
+ // pull_number: number,
34
+ // title,
35
+ // body,
36
+ // })
37
+ }
Original file line number Diff line number Diff line change 43
43
run : node .github/scripts/prepare-release.mjs
44
44
env :
45
45
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46
+
47
+ website-pr :
48
+ name : Update website PR
49
+ runs-on : ubuntu-latest
50
+
51
+ permissions :
52
+ pull-requests : write
53
+
54
+ steps :
55
+ - name : Checkout code
56
+ uses : actions/checkout@v4
57
+
58
+ - name : Install pnpm
59
+ uses : pnpm/action-setup@v4
60
+ with :
61
+ run_install : false
62
+
63
+ - name : Set up Node.js
64
+ uses : actions/setup-node@v4
65
+ with :
66
+ node-version : 20
67
+ cache : " pnpm"
68
+
69
+ - run : pnpm install
70
+
71
+ - name : Create or update website PR
72
+ run : node .github/scripts/website-pr.mjs
73
+ env :
74
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments