Skip to content

Commit

Permalink
Running the PR<>main version check workflow in main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
AllRWeak committed Sep 23, 2024
1 parent 6309a75 commit 93b8928
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/version_check.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
name: Comparing PR version with the latest version
name: Comparing PR version with the main version

on:
pull_request:
pull_request_target:
types:
- opened
- synchronize
branches:
- main

Expand All @@ -20,6 +23,13 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
path: pr

- name: Cloning Catapult main repository...
uses: actions/checkout@v4
with:
fetch-depth: 0
path: main

- name: Comparing PR version with main...
run: |
Expand All @@ -30,10 +40,28 @@ jobs:
export C_RST="\x1b[0m"
VERSION_FILE="version.yml"
REMOTE_VERSION_URL="https://raw.githubusercontent.com/ClarifiedSecurity/catapult/main/version.yml"
PR_VERSION=$(cat $VERSION_FILE | grep "version:" | cut -d " " -f 2)
CURRENT_VERSION=$(curl "$REMOTE_VERSION_URL" -s | grep "version:" | cut -d " " -f 2)
if [[ -e "pr/$VERSION_FILE" ]]; then
PR_VERSION=$(cat pr/$VERSION_FILE | grep "version:" | cut -d " " -f 2)
else
echo "pr/$VERSION_FILE does not exist."
exit 1
fi
if [[ -e "main/$VERSION_FILE" ]]; then
CURRENT_VERSION=$(cat main/$VERSION_FILE | grep "version:" | cut -d " " -f 2)
else
echo "main/$VERSION_FILE does not exist."
exit 1
fi
echo -n -e "${C_YELLOW}"
echo -e "Pull Request Version - $PR_VERSION"
Expand Down
2 changes: 1 addition & 1 deletion version.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 5.5.81
version: 5.5.82

0 comments on commit 93b8928

Please sign in to comment.