Skip to content

Commit

Permalink
BWS-PKG - GitHub Actions - Add ability to check if the new pushed bra…
Browse files Browse the repository at this point in the history
…nch is the current correct version for this repo

This will prevent accidental pushes from future to current and vise versa

The correct current versions are stored in https://github.com/bywatersolutions/bywater-koha-versions
  • Loading branch information
kylemhall committed Sep 10, 2024
1 parent fbf94e9 commit 5955387
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/github_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,33 @@ on:
tags-ignore:
- "**"
jobs:
check-repo:
name: Check for correct repo
runs-on: ubuntu-latest
steps:
- name: Get repository name
run: |
REPO_NAME="${{ github.repository }}"
REPO_NAME=$(echo "$REPO_NAME" | cut -d'/' -f2)
echo "$REPO_NAME"
echo "REPO NAME: $REPO_NAME"
URL="https://raw.githubusercontent.com/bywatersolutions/bywater-koha-versions/main/$REPO_NAME"
echo "URL: $URL"
curl -o version.txt $URL
CORRECT_KOHA_VERSION=$(cat version.txt)
echo "CORRECT KOHA VERSION: $CORRECT_KOHA_VERSION"
if [[ "$REPO_NAME" == *"$CORRECT_KOHA_VERSION"* ]]; then
echo "Koha version pushed matches the current Koha version for repo $REPO_NAME"
exit 0
else
echo "Koha version pushed *does not match* the current Koha version for repo $REPO_NAME"
exit 1
fi
is-a-mark:
if: "contains(github.event.head_commit.message, ' - Set bwsbranch to')"
name: Check for mark
needs: [check-repo]
runs-on: ubuntu-latest
steps:
- name: Print commit message
Expand All @@ -17,6 +41,7 @@ jobs:
has-ncip-version:
name: Has a matching NCIP server version
needs: [check-repo]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -40,6 +65,7 @@ jobs:
unit-test:
if: github.repository == 'bywatersolutions/bywater-koha' || github.repository == 'bywatersolutions/bywater-koha-future' || github.repository == 'bywatersolutions/bywater-koha-security'
name: Run unit tests
needs: [check-repo]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down

0 comments on commit 5955387

Please sign in to comment.