Skip to content

Commit

Permalink
Add job checking if version is bumped on feature branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekbanas committed Dec 23, 2024
1 parent 032efc8 commit 66d1a93
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: ⬆️ Check Version Bump

on:
pull_request:
branches: [main]

jobs:
check-version:
runs-on: ubuntu-latest

steps:
- name: Checkout source branch
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
path: source

- name: Checkout target branch
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.base.sha }}
path: target

- name: Compare versions
id: compare_versions
run: |
SOURCE_VERSION=$(awk '/^Version:/ { print $2 }' source/DESCRIPTION)
TARGET_VERSION=$(awk '/^Version:/ { print $2 }' target/DESCRIPTION)
echo "Source package version: $SOURCE_VERSION"
echo "Target package version: $TARGET_VERSION"
if [ "$SOURCE_VERSION" == "$TARGET_VERSION" ]; then
echo "Versions are identical"
echo "::set-output name=versions_identical::true"
else
echo "Versions differ"
echo "::set-output name=versions_identical::false"
fi
- name: Fail if versions are identical
if: steps.compare_versions.outputs.versions_identical == 'true'
run: |
echo "The package versions are identical between the source and target branches."
exit 1

0 comments on commit 66d1a93

Please sign in to comment.