Skip to content

version: 6.6.15

version: 6.6.15 #141

Workflow file for this run

---
name: Comparing PR version with the main version
permissions:
contents: read
on:
pull_request_target:
types:
- opened
- synchronize
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
version_check:
runs-on: ubuntu-latest
steps:
- name: Comparing PR version with main...
env:
PR_VERSION_URL: "https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.ref }}/nova/core/galaxy.yml"
run: |
export C_RED="\x1b[91m"
export C_GREEN="\x1b[92m"
export C_YELLOW="\x1b[93m"
export C_RST="\x1b[0m"
PR_VERSION=$(curl -s $PR_VERSION_URL | grep "version:" | cut -d " " -f 2)
CURRENT_VERSION_URL="https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/\
${{ github.event.pull_request.base.ref }}/version.yml"
CURRENT_VERSION=$(curl -s $CURRENT_VERSION_URL | grep "version:" | cut -d " " -f 2)
# Error if PR_VERSION is not found
if [ -z "$PR_VERSION" ]; then
echo -n -e "${C_RED}"
echo -e "Pull request version not found in $PR_VERSION_URL"
echo -n -e "${C_RST}"
exit 1
fi
echo -n -e "${C_YELLOW}"
echo -e "Pull Request Version - $PR_VERSION"
echo -e "Current Version - $CURRENT_VERSION"
echo -n -e "${C_RST}"
if dpkg --compare-versions $PR_VERSION le $CURRENT_VERSION; then
echo -n -e "${C_RED}"
echo -e "Pull request version $PR_VERSION is <= than current version $CURRENT_VERSION."
echo -e "Please update the version in $VERSION_FILE file."
echo -n -e "${C_RST}"
exit 1
else
echo -n -e "${C_GREEN}"
echo "Version has been updated moving on"
echo -n -e "${C_RST}"
fi