From d53fc4fd6a29c3425b0226e6fbe6db917749f108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Kwiecin=CC=81ski?= Date: Wed, 17 Jan 2024 10:23:15 +0100 Subject: [PATCH] Always use `latest` tool version --- .github/workflows/main.yml | 2 ++ action.yml | 7 ++++++- entrypoint.sh | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 323c201..e623533 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,6 +37,7 @@ jobs: configuration: runtimeClasspath build-root-directory: testproject project: "" + debug: "true" - uses: peter-evans/find-comment@v2 id: find_comment @@ -90,6 +91,7 @@ jobs: if: github.event_name == 'pull_request' with: configuration: runtimeClasspath + lib-version: "1.2.1" build-root-directory: testproject additional-gradle-arguments: "--no-configuration-cache --stacktrace" project: "" diff --git a/action.yml b/action.yml index 2622797..7d9c495 100644 --- a/action.yml +++ b/action.yml @@ -16,11 +16,15 @@ inputs: lib-version: description: 'Dependency diff library version' required: true - default: '1.2.1' + default: 'latest' additional-gradle-arguments: description: 'Additional arguments passed to gradle commands' required: false default: '' + debug: + description: 'Enable debug logs' + required: false + default: 'false' outputs: text-diff: description: "Dependency diff" @@ -39,5 +43,6 @@ runs: INPUT_BUILD_ROOT_DIR: ${{ inputs.build-root-directory }} INPUT_VERSION: ${{ inputs.lib-version }} ADDITIONAL_GRADLE_ARGUMENTS: ${{ inputs.additional-gradle-arguments }} + INPUT_DEBUG: ${{ inputs.debug }} run: ${{ github.action_path }}/entrypoint.sh shell: bash diff --git a/entrypoint.sh b/entrypoint.sh index e4c8952..e847227 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,13 +2,26 @@ cd "$INPUT_BUILD_ROOT_DIR" -wget "https://github.com/JakeWharton/dependency-tree-diff/releases/download/$INPUT_VERSION/dependency-tree-diff.jar" -q -O dependency-tree-diff.jar +if [ "$INPUT_VERSION" == "latest" ]; then + curl -s https://api.github.com/repos/JakeWharton/dependency-tree-diff/releases/latest \ + | grep "/dependency-tree-diff.jar" \ + | cut -d : -f 2,3 \ + | tr -d \" \ + | wget -qi - -O dependency-tree-diff.jar +else + wget "https://github.com/JakeWharton/dependency-tree-diff/releases/download/$INPUT_VERSION/dependency-tree-diff.jar" -q -O dependency-tree-diff.jar + fi if [ "$INPUT_PROJECT" == ":" ]; then INPUT_PROJECT="" fi -./gradlew $ADDITIONAL_GRADLE_ARGUMENTS projects + +if [ "$INPUT_DEBUG" == "true" ]; then + echo "downloaded /dependency-tree-diff.jar" + ls -al + ./gradlew $ADDITIONAL_GRADLE_ARGUMENTS projects +fi ./gradlew $ADDITIONAL_GRADLE_ARGUMENTS "$INPUT_PROJECT":dependencies --configuration "$INPUT_CONFIGURATION" >new_diff.txt git fetch --force origin "$INPUT_BASEREF":"$INPUT_BASEREF" --no-tags git switch --force "$INPUT_BASEREF"