Skip to content

Commit

Permalink
Update update-release-version-in-readme.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
alhasacademy96 authored Oct 23, 2024
1 parent 5b4f3ee commit 1243a6a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/update-release-version-in-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history so we can push back to the branch
fetch-depth: 0 # Ensure full history is available for pushing

- name: Switch to the main branch
run: |
git fetch origin main # Ensure the main branch is up to date
git checkout main # Switch to the main branch
git fetch origin main # Fetch latest main branch
git checkout main # Explicitly switch to main branch
git reset --hard origin/main # Reset to match remote state
- name: Get latest release version
run: echo "LATEST_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
Expand All @@ -31,4 +32,9 @@ jobs:
git config --global user.name "github-actions[bot]"
git add README.md
git commit -m "Update latest release version to $LATEST_VERSION"
git push origin main # Push to the main branch
git push origin main # Push changes to main branch
- name: Handle detached HEAD (if still in detached state)
if: failure() # Only run this if the previous push fails due to detached HEAD
run: |
git push origin HEAD:main # Push from detached HEAD to main branch

0 comments on commit 1243a6a

Please sign in to comment.