Skip to content

Test/lint md #63

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

Closed
wants to merge 12 commits into from
14 changes: 14 additions & 0 deletions .github/workflows/TODO.md
Original file line number Diff line number Diff line change
@@ -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
102 changes: 102 additions & 0 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
@@ -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 }}
30 changes: 30 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading