diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index daaf0e8d71..bdad7c6aa6 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -6,9 +6,34 @@ on: tags-ignore: - "**" jobs: + check-repo: + name: Check for correct repo + runs-on: ubuntu-latest + steps: + - name: Get repository name + run: | + echo "Branch: ${{ github.ref_name }}" + 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 [[ "${{ github.ref_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 @@ -17,6 +42,7 @@ jobs: has-ncip-version: name: Has a matching NCIP server version + needs: [check-repo] runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -40,6 +66,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