From 8061bb76376a6491ea267abadb4924d03d58316e Mon Sep 17 00:00:00 2001 From: greensd4 <33864348+greensd4@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:42:49 +0200 Subject: [PATCH] Use Git LFS for wrapper update --- .github/workflows/update-cli.yml | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-cli.yml b/.github/workflows/update-cli.yml index 25bcdef7..319bbedf 100644 --- a/.github/workflows/update-cli.yml +++ b/.github/workflows/update-cli.yml @@ -8,7 +8,18 @@ jobs: update-checkmarx-cli: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.5.2 + - uses: actions/checkout@v4.1.7 + with: + lfs: true + + - name: Install Git LFS + run: git lfs install + + - name: Configure Git user + run: | + git config --global user.name github-actions[bot] + git config --global user.email github-actions[bot]@users.noreply.github.com + - name: Get Latest Checkmarx Java wrapper version id: ast-cli-java-wrapper run: | @@ -27,9 +38,26 @@ jobs: cd checkmarx-ast-eclipse-plugin/lib/ rm -rf "$current_version" curl "https://repo1.maven.org/maven2/com/checkmarx/ast/ast-cli-java-wrapper/${{ steps.ast-cli-java-wrapper.outputs.release_tag }}/${new_version}" --output $new_version + + # Track the new JAR file with LFS + FILE_PATH="checkmarx-ast-eclipse-plugin/lib/$new_version" # Correct path + # Create the directory if it doesn't exist (important!) + mkdir -p "checkmarx-ast-eclipse-plugin/lib" + mv $new_version $FILE_PATH + # Ensure the file exists after download + if [ ! -f "$FILE_PATH" ]; then + echo "Error: File $FILE_PATH not found after download." + exit 1 # Fail the workflow + fi + git lfs track "$FILE_PATH" + git add .gitattributes + git add "$FILE_PATH" + git commit -m "Update ast-cli-java-wrapper to ${{ steps.ast-cli-java-wrapper.outputs.release_tag }}" + git push origin HEAD:${{ github.ref }} + - name: Create Pull Request if: steps.ast-cli-java-wrapper.outputs.current_tag != steps.ast-cli-java-wrapper.outputs.release_tag - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6.1.0 with: token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} commit-message: Update ast-cli-java-wrapper to ${{ steps.ast-cli-java-wrapper.outputs.release_tag }}