3 # Get the repo with the commits(+1) in the series.
4 # Process `git log --check` output to extract just the check errors.
5 # Add a comment to the pull request with the check errors.
9 types: [opened, synchronize]
13 runs-on: ubuntu-latest
15 - name: Set commit count
17 run: echo "::set-env name=COMMIT_DEPTH::$((1+$COMMITS))"
19 COMMITS: ${{ github.event.pull_request.commits }}
21 - uses: actions/checkout@v2
23 fetch-depth: ${{ env.COMMIT_DEPTH }}
25 - name: git log --check
39 if test -n "${commit}"
41 log="${log}\n${commit}"
46 log="${log}\n${dash} ${etc}"
50 done <<< $(git log --check --pretty=format:"---% h% s" -${{github.event.pull_request.commits}})
54 echo "::set-output name=checkout::"${log}""
58 - name: Add Check Output as Comment
59 uses: actions/github-script@v3
63 github.issues.createComment({
64 issue_number: context.issue.number,
65 owner: context.repo.owner,
66 repo: context.repo.repo,
67 body: "Whitespace errors found in workflow ${{ github.workflow }}:\n\n${{ steps.check_out.outputs.checkout }}"