diff --git a/.github/workflows/pr_commits.yml b/.github/workflows/pr_commits.yml index b088e19..b9e4a46 100644 --- a/.github/workflows/pr_commits.yml +++ b/.github/workflows/pr_commits.yml @@ -8,10 +8,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + - uses: dart-lang/setup-dart@v1.3 - name: Get Dependencies run: dart pub get - name: Validate PR Commits - run: dart run commitlint_cli --from="${{ github.base_ref }}" --to="${{ github.head_ref }}" --config lib/commitlint.yaml \ No newline at end of file + run: VERBOSE=true dart run commitlint_cli --from="${{ github.base_ref }}" --to="${{ github.head_ref }}" --config lib/commitlint.yaml \ No newline at end of file diff --git a/lib/src/read.dart b/lib/src/read.dart index 8301638..790d78b 100644 --- a/lib/src/read.dart +++ b/lib/src/read.dart @@ -1,5 +1,8 @@ import 'dart:io'; import 'package:path/path.dart'; +import 'package:verbose/verbose.dart'; + +final verbose = Verbose('commitlint:read'); /// Read commit messages in given range([from], [to]), /// or in [edit] file. @@ -11,6 +14,7 @@ Future> read({ String? workingDirectory, Iterable? gitLogArgs, }) async { + verbose('from = $from, to = $to, edit = $edit'); if (edit != null) { return await _getEditingCommit( edit: edit, workingDirectory: workingDirectory); @@ -26,11 +30,14 @@ Future> _getRangeCommits({ required Iterable gitLogArgs, String? workingDirectory, }) async { + verbose('git log ${gitLogArgs.join(' ')}'); final result = await Process.run( 'git', ['log', ...gitLogArgs], workingDirectory: workingDirectory, ); + verbose('stdout = ${result.stdout}'); + verbose('stderr = ${result.stderr}'); return ((result.stdout as String).trim().split('\n')) .where((message) => message.trim().isNotEmpty) .toList(); @@ -40,11 +47,14 @@ Future> _getEditingCommit({ required String edit, String? workingDirectory, }) async { + verbose('git rev-parse --show-toplevel'); final result = await Process.run( 'git', ['rev-parse', '--show-toplevel'], workingDirectory: workingDirectory, ); + verbose('stdout = ${result.stdout}'); + verbose('stderr = ${result.stderr}'); final root = result.stdout.toString().trim(); final file = File(join(root, edit)); if (await file.exists()) {