File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 git config --global user.email "github-actions[bot]@users.noreply.github.com"
3737 git config --global user.name "github-actions[bot]"
3838
39+ - name : Update CHANGELOG.md with release notes
40+ env :
41+ RELEASE_BODY : ${{ github.event.release.body }}
42+ RELEASE_TAG : ${{ github.event.release.tag_name }}
43+ RELEASE_DATE : ${{ github.event.release.published_at }}
44+ TARGET_BRANCH : ${{ github.event.release.target_commitish }}
45+ run : |
46+ python3 - <<'PYEOF'
47+ import os
48+
49+ tag = os.environ['RELEASE_TAG']
50+ body = os.environ['RELEASE_BODY'].strip()
51+ date = os.environ['RELEASE_DATE'][:10]
52+
53+ new_section = f"## [{tag}] - {date}\n\n{body}\n\n---\n\n"
54+
55+ with open('CHANGELOG.md', 'r') as f:
56+ content = f.read()
57+
58+ marker = '\n---\n'
59+ pos = content.index(marker) + len(marker)
60+ updated = content[:pos] + '\n' + new_section + content[pos:]
61+
62+ with open('CHANGELOG.md', 'w') as f:
63+ f.write(updated)
64+
65+ print(f"Added {tag} to CHANGELOG.md")
66+ PYEOF
67+ git add CHANGELOG.md
68+ git commit -m "Add release notes for ${RELEASE_TAG} to CHANGELOG.md [skip ci]"
69+ git push origin HEAD:"${TARGET_BRANCH}"
70+
3971 - name : Build and publish documentation
4072 run : |
4173 pip install mkdocs
You can’t perform that action at this time.
0 commit comments