Skip to content

Commit

Permalink
feat(ci): Add reviewdog implementation (#4)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
MalteHerrmann authored Jun 30, 2024
1 parent 2bb178e commit 4fdc13e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/lint-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Changelog Linter
on:
pull_request:

permissions:
pull-requests: write
contents: read

jobs:
lint-changelog:
runs-on: ubuntu-latest
Expand All @@ -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 }}


1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ FROM ghcr.io/malteherrmann/changelog-utils:latest

WORKDIR /github/workspace

CMD ["lint"]
COPY entrypoint.sh .

ENTRYPOINT ["./entrypoint.sh"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
10 changes: 10 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 4fdc13e

Please sign in to comment.