-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (72 loc) · 2.58 KB
/
Copy pathrelease-changelog.yml
File metadata and controls
83 lines (72 loc) · 2.58 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Release changelog
on:
release:
types: [published]
jobs:
update-changelog-after-publish-a-release:
name: GitHub Actions Test
if: ${{ false }}
runs-on: macOS-latest
permissions:
contents: write
pull-requests: write
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'
# Install rush
- name: Install rush
run: node common/scripts/install-run-rush.js install --bypass-policy
- name: Create branch
run: |
git status
git fetch origin main:main
git checkout main
git status
git checkout -b docs/generate-changelog-${{ github.event.release.tag_name }}
- name: generate changelog
id: generate-changelog
uses: xile611/collect-release-changelog@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
folder: ./docs/assets/changelog
langs: 'en,zh'
tag_name: ${{github.event.release.tag_name}}
file_name: release.md
- name: Build packages
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: node common/scripts/install-run-rush.js build --only tag:package
- name: Push branch
run: |
git add .
git commit -m "docs: generate changelog of release ${{ github.event.release.tag_name }}" -n
git push origin docs/generate-changelog-${{ github.event.release.tag_name }}
- name: Create Pull Request
env:
GH_TOKEN: ${{ github.token }}
BRANCH: docs/generate-changelog-${{ github.event.release.tag_name }}
run: |
set -euo pipefail
if gh pr list --base main --head "$BRANCH" --state open --json number --limit 1 | grep -q '"number"'; then
echo "PR from $BRANCH to main already exists, skip creating."
exit 0
fi
gh pr create \
--base main \
--head "$BRANCH" \
--title "[Auto changelog] changelog of ${{ github.event.release.tag_name }}" \
--body "update changelog of ${{ github.event.release.tag_name }}" \
--label changelog