From 4fdc13e466ac69dc599d71440e32d7cff693c084 Mon Sep 17 00:00:00 2001 From: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Date: Sun, 30 Jun 2024 14:49:40 +0200 Subject: [PATCH] feat(ci): Add reviewdog implementation (#4) * commit wip adding reviewdog implementation * bump version in used ci action * add GH token to use with linter * make entrypoint executable * remove filter from reviewdog (not functioning correctly somehow..) * write permissions for action * perms 2 * fail on error * add readme * adjust name * update changelog --- .github/workflows/lint-changelog.yaml | 9 ++++++++- CHANGELOG.md | 1 + Dockerfile | 4 +++- README.md | 7 +++++++ action.yml | 4 ++++ entrypoint.sh | 10 ++++++++++ 6 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 README.md create mode 100755 entrypoint.sh diff --git a/.github/workflows/lint-changelog.yaml b/.github/workflows/lint-changelog.yaml index 1059626..ca5484a 100644 --- a/.github/workflows/lint-changelog.yaml +++ b/.github/workflows/lint-changelog.yaml @@ -3,6 +3,10 @@ name: Changelog Linter on: pull_request: +permissions: + pull-requests: write + contents: read + jobs: lint-changelog: runs-on: ubuntu-latest @@ -12,5 +16,8 @@ jobs: uses: actions/checkout@v4 - name: Run changelog linter - uses: MalteHerrmann/changelog-lint-action@0918ef12e6dc06adce0743e1c6c13707a7c20323 + uses: ./ + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/CHANGELOG.md b/CHANGELOG.md index bb677b4..a4905ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,4 +8,5 @@ This changelog was created using the `clu` binary ### Features +- (ci) [#2](https://github.com/MalteHerrmann/changelog-lint-action/pull/2) Add reviewdog to post PR review comments. - (ci) [#1](https://github.com/MalteHerrmann/changelog-lint-action/pull/1) Add action implementation. diff --git a/Dockerfile b/Dockerfile index 5453e80..818cd1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,4 +2,6 @@ FROM ghcr.io/malteherrmann/changelog-utils:latest WORKDIR /github/workspace -CMD ["lint"] +COPY entrypoint.sh . + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..1f1f69a --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Changelog Lint Action + +This GitHub action brings the linter from the [changelog-utils](https://github.com/MalteHerrmann/changelog-utils) +to your CI workflows. + +It's using [reviewdog](https://github.com/reviewdog/reviewdog) to post comments on PR reviews that show any potential +problems with your changelogs. \ No newline at end of file diff --git a/action.yml b/action.yml index 8ba5e2c..85250dd 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,10 @@ name: 'Changelog Linter' description: 'A linter for your changelog. Based on https://github.com/MalteHerrmann/changelog-utils' author: 'Malte Herrmann' +inputs: + github_token: + description: 'GITHUB_TOKEN' + default: '${{ github.token }}' outputs: linter-results: description: 'Changelog linter output' diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..294feb2 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -ex + +export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" + +clu lint | reviewdog -efm="%f:%l: %m" \ + -name="clu" \ + -reporter="github-pr-review" \ + -filter-mode="nofilter" \ + -fail-on-error="true"