-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (36 loc) · 1.25 KB
/
release-pr.yaml
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
38
39
40
41
42
43
name: Release PR
on:
push:
branches:
- next
permissions:
contents: read
jobs:
release_pr:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install Dependencies
run: npm ci
- name: Generate Changes
run: |
echo '# Release Changes' > changes.md
echo 'n' | npx lerna version --no-changelog --no-commit-hooks --no-git-tag-version --no-push 2> /dev/null | head -n -3 | tee -a changes.md
printf '\n---\n\n### Approve this PR to release above packages!' >> changes.md
- name: Create PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -ex
export PR_NUMBER=$(gh pr list -B master -H next --json number | jq -r '.[0].number')
if [[ "$(git rev-parse origin/master)" == "$(git rev-parse origin/next)" ]]; then exit 0; fi
if [[ "$PR_NUMBER" == "null" ]]; then gh pr create -B master -H next -t "chore: release" -F changes.md; fi
if [[ "$PR_NUMBER" != "null" ]]; then gh pr edit $PR_NUMBER -F changes.md; fi