-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Set up markdownlint GitHub Action for automated linting (Closes #14) #42
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
531e780
Adds lint.yaml with linting instructions for changed MD files
EmersonFras 69719b3
Updates contributing.md with automated linting information
EmersonFras cda3921
test: add bad markdown to verify linter failure
EmersonFras 2152882
test: remove bad markdown file used for testing
EmersonFras 33ec57c
Implements -f in action to auto-fix small md errors
EmersonFras f1a233f
test: add bad markdown to verify auto-fixes
EmersonFras 07de5c4
Explicitly push HEAD to the PR branch for auto-fixes
EmersonFras d41c5d5
Merge 07de5c40550fc5697211347308a1906a5fcd360f into f5bab9dfe0d59b6b4…
EmersonFras bc39e08
style: auto-fix markdown formatting
github-actions[bot] c83003f
Clarification on automated checks and legacy issues
EmersonFras ee109e5
Revert markdownlint-cli2 back to markdownlint for local testing
EmersonFras fab4aeb
Revert automated workflow lint fixing
EmersonFras c17b1e8
test: Remove lint-fail-test.md
EmersonFras a414bcd
Fix linter name in local testing section
EmersonFras ad25ccf
Instructions to check details for automated check fail
EmersonFras f47864b
Update CONTRIBUTING.md to include lint URLs
EmersonFras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Linting | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| # This identifies which files changed in the specific commit or PR | ||
| - uses: tj-actions/changed-files@v47 | ||
| id: changed-files | ||
| with: | ||
| files: '**/*.md' | ||
| separator: "," | ||
|
|
||
| # This runs the linter ONLY on the files identified above | ||
| - uses: DavidAnson/markdownlint-cli2-action@v22 | ||
| if: steps.changed-files.outputs.any_changed == 'true' | ||
| with: | ||
| globs: ${{ steps.changed-files.outputs.all_changed_files }} | ||
| separator: "," | ||
| fix: true | ||
|
|
||
| # Check if anything was fixed, then Commit & Push | ||
| - name: Commit and push fixes | ||
| if: always() && steps.changed-files.outputs.any_changed == 'true' | ||
| run: | | ||
| # Configure the bot's identity | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| # Check if the linter modified any files | ||
| if [[ -n $(git status -s) ]]; then | ||
| git add . | ||
| git commit -m "style: auto-fix markdown formatting" | ||
| git push origin HEAD:${{ github.head_ref }} | ||
| fi |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Auto-Fixable Header (No space after hash) | ||
|
|
||
| This paragraph has trailing spaces at the end. | ||
|
|
||
| # Duplicate Header | ||
|
|
||
| Content A | ||
|
|
||
| # Duplicate Header | ||
|
|
||
| Content B (Linter won't be able to fix the duplicate header but should point it out) | ||
|
|
||
| <div class="error"> | ||
| Inline HTML is also not auto-fixable | ||
| </div> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.