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 717c900
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/github_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,37 @@ on:
tags-ignore:
- "**"
jobs:
check-repo:
runs-on: ubuntu-latest

steps:
- name: Get repository name
run: echo "REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV

- name: Download the file
run: |
REPO_NAME="${{ env.REPO_NAME }}"
curl -o version.txt https://raw.githubusercontent.com/bywatersolutions/bywater-koha-versions/main/$REPO_NAME
- name: Read file content
id: read-file
run: |
CORRECT_KOHA_VERSION=$(cat version.txt)
echo "CORRECT_KOHA_VERSION::$CORRECT_KOHA_VERSION" >> $GITHUB_ENV
- name: Check
run: |
REPO_NAME="${{ env.REPO_NAME }}"
CORRECT_KOHA_VERSION="${{ env.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
Expand Down Expand Up @@ -40,6 +71,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 717c900

Please sign in to comment.