1
1
name : Update checkmarx ast cli
2
+
2
3
on :
3
4
workflow_dispatch :
5
+ inputs :
6
+ cli-tag :
7
+ description : ' Optional CLI tag to upgrade to'
8
+ required : false
4
9
repository_dispatch :
5
10
types : [cli-version-update]
6
11
@@ -23,51 +28,57 @@ jobs:
23
28
git config --global user.name github-actions
24
29
git config --global user.email [email protected]
25
30
26
- - name : Get Latest Checkmarx API version
27
- id : checkmarx-ast- cli
31
+ - name : Determine target CLI version
32
+ id : determine- cli-version
28
33
run : |
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)
34
+ if [ -n "${{ github.event.inputs.cli-tag }}" ]; then
35
+ echo "Using user-provided CLI tag: ${{ github.event.inputs.cli-tag }}"
36
+ echo "release_tag=${{ github.event.inputs.cli-tag }}" >> $GITHUB_OUTPUT
37
+ else
38
+ echo "Fetching latest release from GitHub..."
39
+ LATEST_TAG=$(curl -sL https://api.github.com/repos/Checkmarx/ast-cli/releases/latest | jq -r ".tag_name")
40
+ echo "release_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
41
+ fi
42
+ echo "current_tag=$(<checkmarx-ast-cli.version)" >> $GITHUB_OUTPUT
31
43
32
- - name : Update Checkmarx cli version
33
- 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 }}
36
- run : |
37
- # Update current release
38
- echo ${{ steps.checkmarx-ast-cli.outputs.release_tag }} > checkmarx-ast-cli.version
44
+ - name : Update Checkmarx CLI version file
45
+ if : steps.determine-cli-version.outputs.current_tag != steps.determine-cli-version.outputs.release_tag
46
+ run : echo "${{ steps.determine-cli-version.outputs.release_tag }}" > checkmarx-ast-cli.version
39
47
40
- - name : Download latest cli and update branch
41
- if : steps.checkmarx-ast- cli.outputs.current_tag != steps.checkmarx-ast- cli.outputs.release_tag
48
+ - name : Download CLI and run update script
49
+ if : steps.determine- cli-version .outputs.current_tag != steps.determine- cli-version .outputs.release_tag
42
50
run : |
43
- # Update binaries
44
51
chmod +x ./.github/scripts/update_cli.sh
45
- ./.github/scripts/update_cli.sh ${{ steps.checkmarx-ast- cli.outputs.release_tag }}
52
+ ./.github/scripts/update_cli.sh ${{ steps.determine- cli-version .outputs.release_tag }}
46
53
47
54
- name : Track large files with Git LFS
48
- if : steps.checkmarx-ast- cli.outputs.current_tag != steps.checkmarx-ast- cli.outputs.release_tag
55
+ if : steps.determine- cli-version .outputs.current_tag != steps.determine- cli-version .outputs.release_tag
49
56
run : |
50
57
git lfs track "src/main/wrapper/resources/cx-linux"
51
58
git lfs track "src/main/wrapper/resources/cx.exe"
52
59
git lfs track "src/main/wrapper/resources/cx-mac"
53
60
git add .gitattributes
54
61
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"
62
+
63
+ - name : Commit and push changes directly (no PR)
64
+ if : github.event.inputs.cli-tag != ''
65
+ run : |
66
+ git add checkmarx-ast-cli.version
67
+ git commit -m "Direct update of Checkmarx CLI to ${{ steps.determine-cli-version.outputs.release_tag }}"
68
+ git push origin HEAD
56
69
57
70
- 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
71
+ if : github.event.inputs.cli-tag == '' && steps.determine-cli-version.outputs.current_tag != steps.determine-cli-version.outputs.release_tag
72
+ uses : peter-evans/create-pull-request@v6
61
73
with :
62
74
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 }}
75
+ commit-message : Update checkmarx-ast-cli to ${{ steps.determine- cli-version .outputs.release_tag }}
76
+ title : Update checkmarx-ast-cli binaries with ${{ steps.determine- cli-version .outputs.release_tag }}
65
77
body : |
66
- Updates [checkmarx-ast-cli][1] to ${{ steps.checkmarx-ast- cli.outputs.release_tag }}
78
+ Updates [checkmarx-ast-cli][1] to ${{ steps.determine- cli-version .outputs.release_tag }}
67
79
68
80
Auto-generated by [create-pull-request][2]
69
81
70
82
[1]: https://github.com/Checkmarx/checkmarx-ast-cli
71
83
labels : cxone
72
- branch : feature/update_cli_${{ steps.checkmarx-ast-cli.outputs.release_tag }}
73
-
84
+ branch : feature/update_cli_${{ steps.determine-cli-version.outputs.release_tag }}
0 commit comments