Skip to content

Commit

Permalink
add markdownlint to changelog workflow (fix #112)
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Larson <LucasLarson@riseup.net>
  • Loading branch information
LucasLarson committed Jun 2, 2022
1 parent 201e72a commit 67ef649
Showing 1 changed file with 50 additions and 13 deletions.
63 changes: 50 additions & 13 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,77 @@ jobs:
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Create local changes
- name: Install `github_changelog_generator`
run: |
command gem install github_changelog_generator
- name: Install `markdownlint`
run: |
command npm install markdownlint
command npm install markdownlint-cli
- name: Create local changes
run: |
command github_changelog_generator \
--user "$(
command git config --get-regexp -- 'remote.*url' |
command sed -E -e 's/(git@|https:..)//' |
command sed -e 's/:/\//' |
command sed -e 's/\.git$//' |
command sed -E -e 's/(git@|https:\/\/)//' \
-e 's/:/\//' \
-e 's/\.git$//' |
command awk -F '/' '{print $2}' |
LC_ALL='C' command sort -u
command head -n 1
)" \
--project "$(
command git remote get-url "$(
{
command git config --get --worktree checkout.defaultRemote ||
command git config --get --local checkout.defaultRemote ||
command git config --get --system checkout.defaultRemote ||
command git config --get --global checkout.defaultRemote ||
printf "origin\n"
} 2>/dev/null
command git config --get --global checkout.defaultRemote
} 2>/dev/null ||
printf 'origin'
)" |
command tr -d "[:space:]" |
command tr -d '[:space:]' |
command xargs basename |
command sed -e "s|.git$||"
command sed -e 's/\.git$//'
)" \
--token ${{ secrets.GITHUB_TOKEN || secrets.PAT }} \
--exclude-labels duplicate,question,invalid,wontfix,nodoc \
--output changelog.md
--exclude-labels 'duplicate,question,invalid,wontfix,nodoc' \
--output "$(
command find -- . \
-maxdepth 1 \
-type f \
-name '*.m*d*' \
'(' \
-name 'change*log*' -o \
-name 'CHANGE*LOG*' \
')' |
command sed -e 's/^.\///'
)"
- name: Lint changelog
run: |
command find -- . \
-maxdepth 1 \
-type f \
-name '*.m*d*' \
'(' \
-name 'change*log*' -o \
-name 'CHANGE*LOG*' \
')' \
-print \
-exec npx markdownlint --fix -- '{}' ';'
- name: Commit files
run: |
command git config -- user.email 'actions@github.com'
command git config -- user.name 'GitHub'
command git add --verbose --all
command find -- . \
-maxdepth 1 \
-type f \
-name '*.m*d*' \
'(' \
-name 'change*log*' -o \
-name 'CHANGE*LOG*' \
')' \
-print \
-exec git add --verbose -- '{}' ';'
command git commit --verbose \
--message='update changelog' ||
exit 0
Expand Down

0 comments on commit 67ef649

Please sign in to comment.