Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!markdownlint-problem-matcher.json
!entrypoint.sh
22 changes: 22 additions & 0 deletions .github/workflows/actions_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release GitHub Actions

on:
workflow_dispatch:
inputs:
tag:
description: "Tag for the release"
required: true

permissions:
contents: read

jobs:
release:
permissions:
actions: read
id-token: write
contents: write

uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
with:
tag: "${{ github.event.inputs.tag }}"
28 changes: 28 additions & 0 deletions .github/workflows/audit_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: NPM Audit Fix Run

on:
workflow_dispatch:
inputs:
force:
description: "Use --force flag for npm audit fix?"
required: true
type: boolean
base_branch:
description: "Specify a base branch"
required: false
default: "main"
schedule:
- cron: "0 0 * * 1"

jobs:
audit-fix:
uses: step-security/reusable-workflows/.github/workflows/audit_fix.yml@v1
with:
force: ${{ inputs.force || false }}
base_branch: ${{ inputs.base_branch || 'main' }}

permissions:
contents: write
pull-requests: write
packages: read
issues: write
37 changes: 37 additions & 0 deletions .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Auto Cherry-Pick from Upstream

on:
workflow_run:
workflows: [ "Release GitHub Actions" ]
types:
- completed

workflow_dispatch:
inputs:
base_branch:
description: "Base branch to create the PR against"
required: true
default: "main"
mode:
description: "Run mode: cherry-pick or verify"
required: false
default: "cherry-pick"

pull_request:
types: [ opened, synchronize, labeled ]

permissions:
contents: write
pull-requests: write
packages: read
issues: write

jobs:
cherry-pick:
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch' || contains(fromJson(toJson(github.event.pull_request.labels)).*.name, 'review-required')
uses: step-security/reusable-workflows/.github/workflows/auto_cherry_pick.yaml@v1
with:
original-owner: "nosborn"
repo-name: "github-action-markdown-cli"
base_branch: ${{ inputs.base_branch || 'main' }}
mode: ${{ github.event_name == 'pull_request' && 'verify' || inputs.mode || 'cherry-pick' }}
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# yamllint disable rule:line-length
---
name: CI

on:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Clone the repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: 3.x
- name: Perform pre-commit checks
uses: step-security/pre-commit-action@v3
env:
SKIP: no-commit-to-branch

local-test:
needs: pre-commit
runs-on: ubuntu-latest
steps:
- name: Clone the repository
uses: actions/checkout@v7
- name: Test the problem matcher
id: expect-failure
uses: ./
with:
config_file: .markdownlintrc
files: .
rules: examples/rules/custom.js
continue-on-error: true
- name: Check the result of the problem matcher test
if: ${{ steps.expect-failure.outcome != 'failure' }}
run: |
exit 1
- name: Test ignore_files
uses: ./
with:
config_file: .markdownlintrc
files: .
ignore_files: examples/ignore/*
rules: examples/rules/custom.js
- name: Test ignore_path
uses: ./
with:
config_file: .markdownlintrc
files: .
ignore_path: examples/.markdownlintignore
rules: examples/rules/custom.js
55 changes: 55 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Publish docker image

on:
workflow_dispatch:
inputs:
release_tag:
description: 'Tag to release'
required: true
type: string

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest
if: startsWith(github.event.inputs.release_tag, 'v')
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@v7
- name: Validate tag format
run: |
TAG=${{ github.event.inputs.release_tag }}
Comment thread
Raj-StepSecurity marked this conversation as resolved.
Resolved
if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "❌ Invalid tag format: $TAG"
exit 1
fi
echo "✅ Valid semver tag: $TAG"
Comment thread
Raj-StepSecurity marked this conversation as resolved.
Resolved
- name: Log in to GitHub Container Registry
uses: step-security/docker-login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU for ARM builds
uses: step-security/setup-qemu-action@v4

- name: Set up Docker Buildx
uses: step-security/setup-buildx-action@v4

- name: Build and push Docker image
uses: step-security/docker-build-push-action@v7
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
Comment thread
Raj-StepSecurity marked this conversation as resolved.
Resolved
ghcr.io/${{ github.repository }}:${{ github.event.inputs.release_tag }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.envrc
node_modules/
7 changes: 7 additions & 0 deletions .markdownlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"default": true,
"MD003": {
"style": "atx"
},
"MD013": false
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
min-release-age=3
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Comment thread
anurag-stepsecurity marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.1
hooks:
- id: gitleaks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
26 changes: 26 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
extends: default

rules:
braces:
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
brackets:
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
comments:
min-spaces-from-content: 1 # agree with Prettier
document-end:
present: false
indentation:
spaces: 2
line-length:
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
new-lines:
type: unix
quoted-strings:
quote-type: double
required: only-when-needed
truthy:
check-keys: false
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:lts-alpine@sha256:7e0bd0460b26eb3854ea5b99b887a6a14d665d14cae694b78ae2936d14b2befb

RUN apk add --no-cache curl jq

COPY package.json package-lock.json /
RUN npm ci --omit=dev

COPY entrypoint.sh /entrypoint.sh
COPY markdownlint-problem-matcher.json /markdownlint-problem-matcher.json
ENTRYPOINT ["/entrypoint.sh"]
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2019-2025 Nick Osborn
Copyright (c) 2026 StepSecurity

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# github-action-markdown-cli
# github-action-markdown-cli

[![StepSecurity Maintained Action](https://raw.githubusercontent.com/step-security/maintained-actions-assets/main/assets/maintained-action-banner.png)](https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions)

A GitHub Action that performs style checking and linting for Markdown/CommonMark files using [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli).

[![CI Workflow Status](https://github.com/step-security/github-action-markdown-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/step-security/github-action-markdown-cli/actions/workflows/ci.yml)

## Usage

Basic usage with all options enabled:

```yaml
- name: markdownlint-cli
uses: step-security/github-action-markdown-cli@v3
with:
files: .
config_file: .markdownlint.yaml
dot: true
ignore_files: examples/ignore/*
ignore_path: examples/.markdownlintignore
rules: examples/rules/custom.js
```

## Inputs

- `files` - what to process (files, directories, globs)
- `config_file` (optional) - configuration file (JSON or YAML)
- `dot` (optional) - include files/folders with a dot (for example `.github`)
- `ignore_files` (optional) - files to ignore/exclude (file, directory, glob)
- `ignore_path` (optional) - path to file with ignore pattern(s)
- `rules` (optional) - custom rule files (file, directory, glob, package)

## License

The scripts and documentation in this project are released under the [MIT License](./LICENSE).
5 changes: 5 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Security Policy

## Reporting a Vulnerability

Please report security vulnerabilities to [security@stepsecurity.io](mailto:security@stepsecurity.io)
32 changes: 32 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: markdownlint-cli
author: 'step-security'
description: Style checker and lint tool for Markdown/CommonMark files.

inputs:
config_file:
description: configuration file (JSON or YAML)
required: false
dot:
description: include files/folders with a dot (for example `.github`)
required: false
files:
description: files, directories, or globs
required: true
ignore_files:
description: files to ignore/exclude
required: false
ignore_path:
description: path to file with ignore pattern(s)
required: false
rules:
description: custom rule files
required: false

runs:
using: docker
image: Dockerfile
Comment thread
Raj-StepSecurity marked this conversation as resolved.
Resolved
Comment thread
Raj-StepSecurity marked this conversation as resolved.
Resolved

branding:
icon: check-circle
color: purple
Loading
Loading