Skip to content

Generate Documentation Changelog #21

Generate Documentation Changelog

Generate Documentation Changelog #21

name: Generate Documentation Changelog
on:
pull_request:
types: [closed]
branches:
- main
workflow_dispatch:
jobs:
generate-changelog:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout vectara-docs Repository
uses: actions/checkout@v3
- name: Clone product-management-tools Repository
uses: actions/checkout@v3
with:
repository: vectara/product-management-tools
token: ${{ secrets.DOC_CHANGELOG_TOKEN }} # ✅ Correct token for private repo
path: product-management-tools
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Generate Changelog
env:
DOC_CHANGELOG_TOKEN: ${{ secrets.DOC_CHANGELOG_TOKEN }}
run: |
python product-management-tools/doc-changelog/doc-changelog.py # ✅ Generates DocCHANGELOG.md
- name: Move DocCHANGELOG.md to the Correct Folder
run: |
mv DocCHANGELOG.md www/docs/DocCHANGELOG.md # ✅ Move file to the correct path
- name: Commit and Push Changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
BRANCH_NAME="auto/changelog-update-$(date +'%Y%m%d-%H%M%S')"
# Create and switch to a new branch
git checkout -b $BRANCH_NAME
# Add and commit the moved file
git add www/docs/DocCHANGELOG.md
git commit -m "📖 Auto-update DocCHANGELOG.md [skip ci]" || echo "No changes to commit"
# Push the branch using DOC_CHANGELOG_TOKEN
git push https://${{ secrets.DOC_CHANGELOG_TOKEN }}@github.com/vectara/vectara-docs.git $BRANCH_NAME
# Create a Pull Request
gh pr create --title "📖 Auto-update DocCHANGELOG.md" \
--body "Automated update of the documentation changelog." \
--head $BRANCH_NAME \
--base main
env:
GITHUB_TOKEN: ${{ secrets.DOC_CHANGELOG_TOKEN }}