Add Docs #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Changelog | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- main # or your default branch name | |
pull_request: | |
branches: | |
- main # or your default branch name | |
jobs: | |
test-changelog-update: | |
if: github.event_name == 'push' || github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests python-dotenv semver | |
- name: Test Changelog Update | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
# Print current directory and list files | |
pwd | |
ls -la | |
# Print Git status and current branch | |
git status | |
git branch | |
# Ensure we're on the correct branch | |
if [ "${{ github.event_name }}" = "pull_request" ]; then | |
git checkout -b ${{ github.head_ref }} | |
else | |
git checkout ${{ github.ref_name }} | |
fi | |
# Run the update script | |
python update_changelog.py | |
# Check for changes and commit if necessary | |
git add docs/changelog.md | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "Update changelog for latest release" | |
git push origin HEAD:${{ github.head_ref || github.ref_name }} | |
fi | |
update-changelog: | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests python-dotenv | |
- name: Update Changelog | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: python update_changelog.py | |
- name: Commit changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add docs/changelog.md | |
git commit -m "Update changelog for latest release" || echo "No changes to commit" | |
git push |