Skip to content

Update CHANGELOG

Update CHANGELOG #47

name: Update CHANGELOG
on:
workflow_dispatch:
inputs:
date:
description: 'Release date (YYYY-MM-DD format)'
required: false
default: ''
days_back:
description: 'Number of days to look back for commits'
required: false
default: ''
jobs:
update-changelog:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Checkout external packages repository
uses: actions/checkout@v5
with:
repository: SuperKali/openwrt-packages
path: ${{ github.workspace }}/openwrt-packages
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r .github/scripts/changelog/requirements.txt
- name: Set release date
id: set-date
run: |
if [ -z "${{ github.event.inputs.date }}" ]; then
echo "RELEASE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
else
echo "RELEASE_DATE=${{ github.event.inputs.date }}" >> $GITHUB_ENV
fi
- name: Update CHANGELOG
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
PACKAGES_REPO_PATH: ${{ github.workspace }}/openwrt-packages
DAYS_BACK: ${{ github.event.inputs.days_back }}
run: |
python .github/scripts/changelog/update_changelog.py
- name: Check for changes
id: check-changes
run: |
git add CHANGELOG.md
if git diff --staged --quiet; then
echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT
else
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
fi
- name: Cleanup
if: always()
run: |
rm -rf ${{ github.workspace }}/openwrt-packages
- name: Create Pull Request
if: steps.check-changes.outputs.HAS_CHANGES == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
branch: update-changelog-${{ env.RELEASE_DATE }}
title: "docs: Update CHANGELOG for ${{ env.RELEASE_DATE }}"
body: |
This PR automatically updates the CHANGELOG.md with the latest changes.
## Changes included:
- Additions from BananaWRT core repository
- Additions from openwrt-packages repository
Please review the changes to ensure they're correctly formatted.
commit-message: "docs: Update CHANGELOG for ${{ env.RELEASE_DATE }}"
labels: documentation, changelog