Skip to content

Update MicrosoftBuildVersion in analyzer template #9

Update MicrosoftBuildVersion in analyzer template

Update MicrosoftBuildVersion in analyzer template #9

Workflow file for this run

name: Version Bump Bot
on:
issue_comment:
types: [created]
jobs:
bump-version:
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/bump') }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.issue.pull_request.head.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update Version
id: version_update
shell: pwsh
run: |
$filePath = "eng/Versions.props"
[xml]$xml = Get-Content $filePath
$versionPrefix = $xml.SelectSingleNode("//VersionPrefix")
$oldVersion = $versionPrefix.InnerText
$parts = $oldVersion -split '\.'
$patchVersion = [int]$parts[2]
$patchVersion++
$parts[2] = $patchVersion.ToString()
$newVersion = $parts -join '.'
$versionPrefix.InnerText = $newVersion
$xml.Save($filePath)
"old_version=$oldVersion" >> $env:GITHUB_ENV
"new_version=$newVersion" >> $env:GITHUB_ENV
- name: Get Current UTC Time
id: current_time
run: echo "time=$(date -u +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
- name: Commit and Push Changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add eng/Versions.props
git commit -m "bump: Update patch version from ${{ env.old_version }} to ${{ env.new_version }}
Triggered by: @${{ github.event.comment.user.login }}
Timestamp (UTC): ${{ env.time }}"
# Push changes with error handling
git push origin HEAD || {
echo "Push failed. Fetching latest changes and retrying..."
git fetch
git rebase origin/${{ github.event.issue.pull_request.head.ref }}
git push origin HEAD
}