diff --git a/.github/workflows/TODO.md b/.github/workflows/TODO.md new file mode 100644 index 0000000..dbb1eed --- /dev/null +++ b/.github/workflows/TODO.md @@ -0,0 +1,14 @@ +Evaluate: + +* markdownlint + * assessment: go + * used by opentelemetry/opentelemetry-go + * packaged as github action +* misspell +* spellcheck +* govulncheck +* [x] godoc-lint: + * assessment: no go + * too simplistic: no real value added + * not integrated into golangci's suite of linters + * no packaged github action diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml new file mode 100644 index 0000000..4f693f6 --- /dev/null +++ b/.github/workflows/markdown.yml @@ -0,0 +1,102 @@ +name: Markdown + +on: + pull_request_target: + paths: + - '**/*.md' + +permissions: + pull-requests: write + contents: read + +jobs: + markdown-changed: + outputs: + proceed: ${ steps.changed-markdown-files.outputs.any_changed } + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Get changed markdown files + id: changed-markdown-files + uses: tj-actions/changed-files@v45 + with: + # Avoid using single or double quotes for multiline patterns + files: | + **/*.md + + lint-markdown: + needs: markdown-changed + if: needs.markdown-changed.outputs.proceed == 'true' + runs-on: ubuntu-latest + env: + lintreport: "./report.txt" + outputs: + proceed: ${{ steps.report-exists.proceed }} + report: ${{ steps.report-exists.report }} + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Run markdown linter + if: steps.changed-markdown-files.outputs.any_changed == 'true' + continue-on-error: true + id: markdownlint + uses: docker://avtodev/markdown-lint:v1 + with: + config: .markdownlint.yml + args: '${{ steps.changed-markdown-files.outputs.all_changed_files }}' + output: ${{ env.lintreport }} + + - name: Comment on success + if: ${{ success() }} + id: congrats + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + Markdown looks good to me. Congrats! + + - name: Check lint report exists + if: ${{ failure() && steps.markdownlint.outcome == 'failure' && hashFiles(env.lintreport) != "" }} + id: report-exist + run: | + echo "proceed=true" >> $GITHUB_OUTPUT + echo "report=$(cat ${{ env.lintreport }})" >> $GITHUB_OUTPUT + + pr-comment: + needs: lint-markdown + if: ${{ needs.lint-markdown.proceed == 'true' && needs.lint-markdown.report != '' }} + env: + comment-title: Markdown linting issues detected in modified files + + steps: + - name: Format PR comment + id: commentformatter + uses: skills/action-text-variables@v1 + with: + template-vars: | + text=${{ steps.conveyor.outputs.report }} + template-text: | + ### ${{ env.comment-title }} + This check is advisory and is not blocking. Please adopt a nice markdown style. + + Markdown rules formatting rules are documented [here](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md). + + {{ text }} + + - name: Find previous PR comment + uses: peter-evans/find-comment@v3 + id: findcomment + with: + issue-number: ${{ github.event.pull_request.number }} + body-includes: ${{ steps.conveyor.outputs.report }} + direction: last + + - name: Create or update PR comment + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + comment-id: ${{ steps.findcomment.outputs.comment-id }} + body: ${{ steps.commentformatter.outputs.updated-text }} diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 0000000..35f8a0f --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,30 @@ +# See rules documentation: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md + +# Default state for all rules +default: true + +# ul-style # default: consistent +# MD004: false + +# hard-tabs +MD010: false + +# line-length +MD013: false + +# no-duplicate-header +MD024: + siblings_only: true + +#single-title +#MD025: false + +# ol-prefix +MD029: + style: ordered + +# no-inline-html +MD033: false + +# fenced-code-language +MD040: false diff --git a/README.md b/README.md index 6d57ea5..3c4c988 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,13 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/errors)](https://goreportcard.com/report/github.com/go-openapi/errors) Shared errors and error interface used throughout the various libraries found in the go-openapi toolkit. + + +## blah blah + +# should raise an issue + +# should raise another issue + +## blah blah +## blah blah