-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (57 loc) · 1.91 KB
/
TheAnswer.ReleaseNotes.yml
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
name: Extract Release Notes to Wiki
on:
release:
types:
- published
- edited
env:
GH_TOKEN: ${{ github.token }}
jobs:
update-wiki:
runs-on: ubuntu-latest
steps:
- name: Verify gh CLI
run: |
gh --version
gh auth status
env:
GH_TOKEN: ${{ github.token }}
- name: Checkout Code Repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: code
- name: Checkout Wiki Repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}.wiki
path: wiki
- name: Extract Release Notes
run: |
# Change directory to the main code repository
cd $GITHUB_WORKSPACE/main_repo
# Fetch the latest release notes
RELEASE_NOTES=$(gh release view ${{ github.event.release.tag_name }} --json body -q ".body")
# Define the file to update
cd $GITHUB_WORKSPACE/wiki
FILE="Release-Notes.md"
echo ${{ github.event.release.tag_name }}
# Format the new release notes with a header
NEW_CONTENT="## ${{ github.event.release.tag_name }} - $(date +"%Y-%m-%d")\n\n$RELEASE_NOTES\n\n"
# If the file exists, append new notes at the top; otherwise, create it
if [ -f "$FILE" ]; then
echo -e "$NEW_CONTENT$(cat $FILE)" > "$FILE"
else
echo -e "$NEW_CONTENT" > "$FILE"
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Commit and Push to Wiki
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update release notes for ${{ github.event.release.tag_name }}"
git push
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}