Skip to content

Commit 154a670

Browse files
Merge pull request #103 from CheckmarxDev/other/AST-104242
Add verify if repo updated with latest CLI Version (AST-104242)
2 parents 7e53c0e + 99f2160 commit 154a670

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Javascript Wrapper Release
32

43
on:
@@ -91,6 +90,21 @@ jobs:
9190
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
9291
echo "::set-output name=CLI_VERSION::$CLI_VERSION"
9392
93+
- name: Check if CLI version is latest
94+
id: check_latest_cli_version
95+
run: |
96+
if [ "${{ inputs.dev }}" == "false" ] || [ -n "${{ inputs.cliTag }}" ] || [ "${{ github.ref }}" != "refs/heads/main" ]; then
97+
exit 0
98+
fi
99+
100+
LATEST_CLI_VERSION=$(curl -s https://api.github.com/repos/Checkmarx/ast-cli/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
101+
if [ "$CLI_VERSION" = "$LATEST_CLI_VERSION" ]; then
102+
echo "Confirm that the CLI version in the repository is up-to-date with the most recent release: $CLI_VERSION"
103+
else
104+
echo "The current repository contains a CLI version that differs from the latest released version: Expected $LATEST_CLI_VERSION, got $CLI_VERSION"
105+
exit 1
106+
fi
107+
94108
- name: NPM ci and build
95109
run: |
96110
npm ci

0 commit comments

Comments
 (0)