From 4e78e895e504eb27cbb726353630033e9ba8e2a8 Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Fri, 29 Mar 2024 12:26:57 -0400 Subject: [PATCH] Add a GHA to enforce version bump --- .github/workflows/check_fits_version.yaml | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/check_fits_version.yaml diff --git a/.github/workflows/check_fits_version.yaml b/.github/workflows/check_fits_version.yaml new file mode 100644 index 00000000..2cedf30e --- /dev/null +++ b/.github/workflows/check_fits_version.yaml @@ -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 + 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:]')" + + - 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:]')" + + - 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