From d5c8b4adbbf882c22b8d0a2cb6d74fb9c9ea5bf3 Mon Sep 17 00:00:00 2001 From: Yigit Boyar Date: Mon, 27 Sep 2021 23:37:10 +0000 Subject: [PATCH] [GH] Use relative paths for ktlint arguments The latest ktlint update removed the support for absolute paths as arguments. https://github.com/pinterest/ktlint/issues/1131 Github workflow used to prepend the checkout source to make paths absolute and now it does not work anymore. This PR replaces it with `..` since we run ktlint inside `activity` project. There is probably a better shell magic to get this but I think .. is good enough for now. (there does not seem to be a consistent solution between mac and linux for relative paths). Bug: n/a Test: locally verified that relative paths with .. works by manually breaking a file's style in room and invoked ktlint in activity as the workflow does. This is an imported pull request from https://github.com/androidx/androidx/pull/247. Resolves #247 Github-Pr-Head-Sha: da899158ad056ba3b40fe19c6f6750163bc34808 GitOrigin-RevId: 80adfcd76e26d9454aaddb15e6914a16eab5f9e8 Change-Id: Ie6ec09c66a57f89970aff9da581135769b43ca9f --- .github/workflows/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index f97cf4837b6ce..6bb9f22285ac1 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -87,7 +87,7 @@ jobs: id: ktlint-file-args run: | set -x - KTLINT_FILES=`echo "${{ steps.changed-files.outputs.files }}" | sed 's|[^ ]* *|--file=${{ github.workspace }}/&|g' | grep -v "*.txt"` + KTLINT_FILES=`echo "${{ steps.changed-files.outputs.files }}" | sed 's|[^ ]* *|--file=../&|g' | grep -v "*.txt"` echo "::set-output name=ktlint-file-args::$KTLINT_FILES" - name: "Parse changed-files as affected files args"