|
6 | 6 | pull_request: |
7 | 7 | branches: [main, develop] |
8 | 8 |
|
| 9 | +env: |
| 10 | + CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Reya Bot |
| 11 | + CI_COMMIT_EMAIL: devcold@voltz.xyz |
| 12 | + |
9 | 13 | jobs: |
10 | 14 | version-consistency: |
11 | 15 | runs-on: ubuntu-latest |
@@ -107,11 +111,29 @@ jobs: |
107 | 111 | BASE_SHA=$(git merge-base HEAD origin/${{ github.base_ref }}) |
108 | 112 |
|
109 | 113 | if git diff $BASE_SHA HEAD -- pyproject.toml | grep -q '^\+.*version = '; then |
110 | | - echo "VERSION_MANUALLY_MODIFIED=true" >> $GITHUB_ENV |
111 | | - echo "Version was manually modified in this PR" |
| 114 | + echo "Version change detected in pyproject.toml" |
| 115 | + |
| 116 | + # Check if the version change was made by the CI bot (auto-commit) |
| 117 | + # Get the commit that last modified the version line in pyproject.toml |
| 118 | + LAST_VERSION_COMMIT=$(git log --oneline -1 --format="%H" -- pyproject.toml) |
| 119 | + LAST_VERSION_AUTHOR=$(git log --oneline -1 --format="%an" -- pyproject.toml) |
| 120 | + LAST_VERSION_MESSAGE=$(git log --oneline -1 --format="%s" -- pyproject.toml) |
| 121 | + |
| 122 | + echo "Last version commit: $LAST_VERSION_COMMIT" |
| 123 | + echo "Last version author: $LAST_VERSION_AUTHOR" |
| 124 | + echo "Last version message: $LAST_VERSION_MESSAGE" |
| 125 | + |
| 126 | + # Check if it was an auto-commit by the CI bot |
| 127 | + if [[ "$LAST_VERSION_MESSAGE" == "chore: bump SDK version to"* ]] && [[ "$LAST_VERSION_AUTHOR" == *"Reya Bot"* ]]; then |
| 128 | + echo "VERSION_MANUALLY_MODIFIED=false" >> $GITHUB_ENV |
| 129 | + echo "Version was modified by CI bot (auto-commit), not manually" |
| 130 | + else |
| 131 | + echo "VERSION_MANUALLY_MODIFIED=true" >> $GITHUB_ENV |
| 132 | + echo "Version was manually modified in this PR" |
| 133 | + fi |
112 | 134 | else |
113 | 135 | echo "VERSION_MANUALLY_MODIFIED=false" >> $GITHUB_ENV |
114 | | - echo "Version was not manually modified in this PR" |
| 136 | + echo "Version was not modified in this PR" |
115 | 137 | fi |
116 | 138 |
|
117 | 139 | - name: Extract version components |
@@ -197,8 +219,8 @@ jobs: |
197 | 219 | - name: Commit version bump |
198 | 220 | if: github.event_name == 'pull_request' && env.NEW_VERSION != '' |
199 | 221 | run: | |
200 | | - git config --local user.email "action@github.com" |
201 | | - git config --local user.name "GitHub Action" |
| 222 | + git config --local user.email "${{ env.CI_COMMIT_EMAIL }}" |
| 223 | + git config --local user.name "${{ env.CI_COMMIT_AUTHOR }}" |
202 | 224 | git add pyproject.toml |
203 | 225 | git commit -m "chore: bump SDK version to $NEW_VERSION" |
204 | 226 | git push origin HEAD:${{ github.head_ref }} |
|
0 commit comments