From 94abf485e2c553fcd9620b60946ce8a6c549834d Mon Sep 17 00:00:00 2001 From: Prince Canuma Date: Tue, 16 Jul 2024 14:11:35 +0200 Subject: [PATCH] formatting --- .github/workflows/update_changelog.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update_changelog.yml b/.github/workflows/update_changelog.yml index a87a1ba3..f2d8f8e3 100644 --- a/.github/workflows/update_changelog.yml +++ b/.github/workflows/update_changelog.yml @@ -30,17 +30,30 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git checkout ${{ github.head_ref || github.ref_name }} + # 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 - git commit -m "Update changelog for latest release" || echo "No changes to commit" - git push - if [[ -n $(git status --porcelain) ]]; then - echo "Changelog was updated. Script is working correctly." + if git diff --staged --quiet; then + echo "No changes to commit" else - echo "No changes to changelog. Please check if this is expected." + 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