Skip to content

Commit

Permalink
Add a GHA to enforce version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkannawadi committed Mar 29, 2024
1 parent c3e8e8b commit 4e78e89
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/check_fits_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check that the version number was bumped if _fits.py was modified

on:
push:
branches:
- main
pull_request:

jobs:
check_version:
runs-on: ubuntu-latest

steps:
- name: Checkout code

Check failure on line 14 in .github/workflows/check_fits_version.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

14:5 [indentation] wrong indentation: expected 6 but found 4
uses: actions/checkout@v2

- name: Get previous version
id: get_previous_version
run: echo "::set-output name=version::$(git show HEAD^:python/lsst/cell_coadds/_fits.py | grep 'MODULE_VERSION =' | cut -d'=' -f2 | tr -d '[:space:]')"

Check failure on line 19 in .github/workflows/check_fits_version.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

19:133 [line-length] line too long (157 > 132 characters)

- name: Get current version
id: get_current_version
run: echo "::set-output name=version::$(grep 'MODULE_VERSION = ' python/lsst/cell_coadds/_fits.py | cut -d'=' -f2 | tr -d '[:space:]')"

Check failure on line 23 in .github/workflows/check_fits_version.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

23:133 [line-length] line too long (141 > 132 characters)

- name: Compare versions
id: compare_versions
run: |
if [[ "${{ steps.get_previous_version.outputs.version }}" == "${{ steps.get_current_version.outputs.version }}" ]]; then
echo "Error: _fits.py was modified but MODULE_VERSION was not!"
exit 1
fi

0 comments on commit 4e78e89

Please sign in to comment.