Skip to content

Commit

Permalink
Always use latest tool version
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski committed Jan 17, 2024
1 parent 7118d2a commit 8a0a8e6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
configuration: runtimeClasspath
build-root-directory: testproject
project: ""
debug: "true"

- uses: peter-evans/find-comment@v2
id: find_comment
Expand Down Expand Up @@ -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: ""
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
17 changes: 15 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
echo "$(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"
Expand Down

0 comments on commit 8a0a8e6

Please sign in to comment.