Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add markdownlint to changelog workflow #113

Merged
merged 1 commit into from
Jun 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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