Skip to content

Commit d042610

Browse files
commit
1 parent 65afb63 commit d042610

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

.github/workflows/update-cli.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Update checkmarx ast cli
2-
32
on:
43
workflow_dispatch:
54
repository_dispatch:
@@ -24,30 +23,50 @@ jobs:
2423
git config --global user.name github-actions
2524
git config --global user.email github-actions@github.com
2625
27-
- name: Set Hardcoded Checkmarx CLI version
26+
- name: Get Latest Checkmarx API version
2827
id: checkmarx-ast-cli
2928
run: |
30-
echo "release_tag=2.3.19" >> $GITHUB_OUTPUT
31-
echo "current_tag=$(<checkmarx-ast-cli.version)" >> $GITHUB_OUTPUT
29+
echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/Checkmarx/ast-cli/releases/latest | jq -r ".tag_name")
30+
echo ::set-output name=current_tag::$(<checkmarx-ast-cli.version)
3231
3332
- name: Update Checkmarx cli version
3433
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag
34+
env:
35+
RELEASE_TAG: ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
3536
run: |
36-
echo "${{ steps.checkmarx-ast-cli.outputs.release_tag }}" > checkmarx-ast-cli.version
37+
# Update current release
38+
echo ${{ steps.checkmarx-ast-cli.outputs.release_tag }} > checkmarx-ast-cli.version
3739
3840
- name: Download latest cli and update branch
3941
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag
4042
run: |
43+
# Update binaries
4144
chmod +x ./.github/scripts/update_cli.sh
4245
./.github/scripts/update_cli.sh ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
4346
44-
- name: Track large files with Git LFS and commit changes
47+
- name: Track large files with Git LFS
4548
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag
4649
run: |
4750
git lfs track "src/main/wrapper/resources/cx-linux"
4851
git lfs track "src/main/wrapper/resources/cx.exe"
4952
git lfs track "src/main/wrapper/resources/cx-mac"
5053
git add .gitattributes
51-
git add src/main/wrapper/resources/cx-linux src/main/wrapper/resources/cx.exe src/main/wrapper/resources/cx-mac checkmarx-ast-cli.version
52-
git commit -m "Update Checkmarx CLI to ${{ steps.checkmarx-ast-cli.outputs.release_tag }}" || echo "No changes to commit"
53-
git push origin HEAD
54+
git add src/main/wrapper/resources/cx-linux src/main/wrapper/resources/cx.exe src/main/wrapper/resources/cx-mac
55+
git commit -m "Track Checkmarx CLI binaries with Git LFS"
56+
57+
- name: Create Pull Request
58+
id: cretae_pull_request
59+
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag
60+
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6
61+
with:
62+
token: ${{ secrets.AUTOMATION_TOKEN }}
63+
commit-message: Update checkmarx-ast-cli to ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
64+
title: Update checkmarx-ast-cli binaries with ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
65+
body: |
66+
Updates [checkmarx-ast-cli][1] to ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
67+
68+
Auto-generated by [create-pull-request][2]
69+
70+
[1]: https://github.com/Checkmarx/checkmarx-ast-cli
71+
labels: cxone
72+
branch: feature/update_cli_${{ steps.checkmarx-ast-cli.outputs.release_tag }}

0 commit comments

Comments
 (0)