aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-10-26 21:25:13 +0530
committerGitHub <noreply@github.com>2020-10-26 16:55:13 +0100
commitb8e07ae98ce7e05d9ceba7384578f12357c89657 (patch)
tree2d352f483a838a68cc16ad84a57ef1ed0eeab029 /.github
parenta0ffebd52e0093f71e1e08a8a624f8ea7bc2dae8 (diff)
github: add workflow to track dependency tree changes (#1176)
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/dependency-tree-diff.yml57
1 files changed, 57 insertions, 0 deletions
diff --git a/.github/workflows/dependency-tree-diff.yml b/.github/workflows/dependency-tree-diff.yml
new file mode 100644
index 00000000..9c38cafc
--- /dev/null
+++ b/.github/workflows/dependency-tree-diff.yml
@@ -0,0 +1,57 @@
+name: Check dependency tree changes
+on:
+ pull_request:
+ types:
+ - opened
+ - edited
+ - synchronize
+ paths:
+ - 'buildSrc/src/main/java/Dependencies.kt'
+ - 'buildSrc/buildDependencies.gradle'
+ - '**/build.gradle.kts'
+
+jobs:
+ compare-dependency-tree:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout pull request tree
+ uses: actions/checkout@c952173edf28a2bd22e1a4926590c1ac39630461
+ with:
+ path: pr-source
+
+ - name: Checkout development tree
+ uses: actions/checkout@c952173edf28a2bd22e1a4926590c1ac39630461
+ with:
+ ref: develop
+ path: dev-source
+
+ - name: Generate and compare dependency trees
+ id: tree-changed
+ run: |
+ set -euxo pipefail
+ curl -sL https://github.com/JakeWharton/dependency-tree-diff/releases/download/1.2.0/dependency-tree-diff.jar -o dependency-tree-diff.jar
+ cd pr-source || exit 1
+ ./gradlew -q :app:dependencies --configuration nonFreeReleaseRuntimeClasspath | tee ../pr-tree.txt
+ cd ../dev-source || exit 1
+ ./gradlew -q :app:dependencies --configuration nonFreeReleaseRuntimeClasspath | tee ../dev-tree.txt
+ cd ../
+ chmod +x dependency-tree-diff.jar
+ ./dependency-tree-diff.jar dev-tree.txt pr-tree.txt > diff.txt
+ if [[ $(($(cat diff.txt | wc -l))) -gt 0 ]]; then
+ echo "::set-output name=diff::$(cat diff.txt)"
+ else
+ echo "::set-output name=diff::null"
+ fi
+
+ - name: Post dependency tree diff to pull request if changed
+ if: ${{ steps.tree-changed.outputs.diff != 'null' }}
+ uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
+ with:
+ result-encoding: string
+ script: |
+ github.issues.createComment({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body: ':warning: **This PR results in dependency tree changes** :warning: \n\n```diff\n${{ steps.tree-changed.outputs.diff }}\n```'
+ })