bump gitpod/workspace-full from bc49ad8
to 230285e
(#241)
#148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Changelog | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 4 | |
if: "!contains(github.event.head_commit.message, 'update changelog')" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1.0 | |
- 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: Build and commit changelog | |
run: | | |
file="$( | |
( | |
command find -- . \ | |
-maxdepth 1 \ | |
-type f \ | |
-name '*.m*d*' \ | |
'(' \ | |
-name 'change*log*' -o \ | |
-name 'CHANGE*LOG*' \ | |
')' \ | |
-print & | |
) | | |
# print only the first match | |
command head -n 1 | |
)" | |
# define changelog location if none is found | |
file="${file:=./changelog.md}" | |
# ensure the file exists | |
command touch -- "${file-}" | |
# trim the initial `./` for `github_changelog_generator` | |
file="${file#*[.][/]}" | |
# create local changes | |
command github_changelog_generator \ | |
--user "$( | |
command git ls-remote --get-url | | |
command sed -E \ | |
-e 's/(git@|(git|https?|ssh):\/\/)//' \ | |
-e 's/:/\//' \ | |
-e 's/[^\/]*\/([^\/]*)\/.*/\1/' | |
)" \ | |
--project "$( | |
command git ls-remote --get-url | | |
command sed \ | |
-e 's/.*\///' \ | |
-e 's/\.git$//' | |
)" \ | |
--token ${{ secrets.GITHUB_TOKEN || secrets.PAT }} \ | |
--exclude-labels 'duplicate,question,invalid,wontfix,nodoc' \ | |
--output "${file-}" | |
# repair changelog credit | |
command sed \ | |
-e 's/This Changelog/This changelog/' \ | |
-e 's/automatically generated/\[automatically generated\]()/' \ | |
-e 's/\]()/\](.\/.github\/workflows\/changelog.yml)/' \ | |
-e 's/generator)\*/generator).\*/' \ | |
./"${file-}" >./"${file%.*}"_temporary_"${file##*.}" && | |
command mv -f -- ./"${file%.*}"_temporary_"${file##*.}" ./"${file-}" | |
# lint changelog | |
command npm exec -- markdownlint --fix -- ./"${file-}" || | |
: | |
# commit files | |
command git config -- user.email '[email protected]' | |
command git config -- user.name 'GitHub' | |
command git add --verbose -- ./"${file-}" | |
command git commit --verbose --message='update changelog' || | |
exit 0 | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN || secrets.PAT }} | |
branch: ${{ github.ref }} | |
... |