fix readme document and code comment #285
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: CI | |
on: | |
push: | |
paths-ignore: | |
- README.md | |
tags-ignore: | |
- '**' | |
# This is necessary https://github.community/t/using-on-push-tags-ignore-and-paths-ignore-together/16931 | |
branches: | |
- '**' | |
pull_request: | |
workflow_dispatch: | |
env: | |
CGO_ENABLED: 0 | |
jobs: | |
tests: | |
name: Unit tests | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
if: "!contains(github.event.head_commit.message, 'bump up version:')" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.19.0' | |
- run: go build | |
- run: go test -v | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
linter: | |
name: Run staticcheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.19.0' | |
- name: Check Go sources are formatted | |
run: | | |
diffs="$(gofmt -d ./*.go)" | |
if [[ "$diffs" != "" ]]; then | |
echo "$diffs" >&2 | |
exit 1 | |
fi | |
- name: Install staticcheck | |
run: | | |
go install honnef.co/go/tools/cmd/staticcheck@latest | |
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | |
- name: Run staticcheck | |
run: | | |
staticcheck --version | |
staticcheck ./ | |
action: | |
name: Check action | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip action check]') && !contains(github.event.head_commit.message, 'bump up version:')" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run action | |
uses: ./action/ | |
with: | |
file: CHANGELOG_FROM_ACTION.md | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
push: false | |
- name: Get output from latest stable command | |
run: | | |
version="$(git tag --list 'v*.*.*' --sort '-v:refname' | head -n 1)" | |
version="${version#v}" | |
echo "extracted latest version: ${version}" | |
curl -LO "https://github.com/rhysd/changelog-from-release/releases/download/v${version}/changelog-from-release_${version}_linux_amd64.tar.gz" | |
tar xf "changelog-from-release_${version}_linux_amd64.tar.gz" changelog-from-release | |
./changelog-from-release > CHANGELOG_FROM_COMMAND.md | |
- run: diff -u CHANGELOG_FROM_ACTION.md CHANGELOG_FROM_COMMAND.md |