Skip to content

Update MicrosoftBuildVersion in analyzer template #4

Update MicrosoftBuildVersion in analyzer template

Update MicrosoftBuildVersion in analyzer template #4

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 (shallow)
uses: actions/checkout@v3
with:
ref: ${{ github.event.issue.pull_request.head.ref }}
fetch-depth: 1 # Faster than fetch-depth: 0
- name: Update Version
id: update-version
run: |
file="eng/Versions.props"
if [[ ! -f "$file" ]]; then
echo "Versions.props not found, skipping."
exit 0
fi
old_version=$(xmllint --xpath 'string(//VersionPrefix)' "$file")
IFS='.' read -r major minor patch <<< "$old_version"
new_version="$major.$minor.$((patch + 1))"
sed -i "s|<VersionPrefix>$old_version</VersionPrefix>|<VersionPrefix>$new_version</VersionPrefix>|" "$file"
echo "old_version=$old_version" >> $GITHUB_ENV
echo "new_version=$new_version" >> $GITHUB_ENV
echo "changed=true" >> $GITHUB_ENV
- name: Commit and Push Changes to PR branch
if: env.changed == 'true'
run: |
git config --local user.email "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 $old_version to $new_version
Triggered by: @${{ github.event.comment.user.login }}
Timestamp (UTC): $(date -u +"%Y-%m-%d %H:%M:%S")"
git push origin ${{ github.event.issue.pull_request.head.ref }}