docker workflow: add pre-build
step
#413
Workflow file for this run
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: Markdown Lint | |
concurrency: | |
group: ${{ github.ref_name }}-markdown | |
cancel-in-progress: true | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- main | |
# Replace pull_request with pull_request_target if you | |
# plan to use this action with forks, see the Limitations section | |
pull_request: | |
branches: | |
- main | |
workflow_call: | |
inputs: | |
enable-spell-check: | |
required: false | |
default: false | |
type: boolean | |
config-links-path: | |
required: false | |
default: '.github/config/md-link-config.json' | |
type: string | |
config-lint-path: | |
default: '.github/config/.markdownlint.json' | |
required: false | |
type: string | |
md-lint-globs: | |
required: false | |
type: string | |
default: | | |
**/*.md | |
**/*.MD | |
#.github | |
#vendor | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
files-changed: ${{ steps.filter.outputs.markdown }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
markdown: | |
- '*.{md,MD}' | |
- '**/*.{md,MD}' | |
- '.github/config/.markdownlint.json' | |
- '.github/config/.prettierignore' | |
- '.github/config/md-link-config.json' | |
- '.github/config/spellcheck.yml' | |
- '.github/config/wordlist.txt' | |
- '.github/workflows/*.yaml' | |
markdown: | |
needs: changes | |
if: ${{ needs.changes.outputs.files-changed == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.REPO_PAT }} | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Prettify MD files | |
uses: zaphiro-technologies/prettier_action@main | |
with: | |
prettier_options: --prose-wrap always --write **/*.{md,MD} | |
dry: true | |
dry_no_fail: true | |
- name: Lint | |
uses: DavidAnson/markdownlint-cli2-action@v11 | |
with: | |
fix: true | |
config: ${{ github.event_name == 'workflow_call' && inputs.config-lint-path || '.github/config/.markdownlint.json' }} | |
globs: ${{ inputs.md-lint-globs || '**/*.{md,MD}' }} | |
- name: Commit markdown-lint changes | |
run: | | |
git config --global user.name 'Bot' | |
git config --global user.email '[email protected]' | |
git commit -am "Automated markdown-lint fixes" || echo "No changes to commit" | |
git push | |
rm -fr vendor | |
# Checks the status of hyperlinks in .md and .MD files in verbose mode (the action is case sensitive and .{MD,md}) | |
- name: Check links (.md) | |
uses: gaurav-nelson/github-action-markdown-link-check@v1 | |
with: | |
config-file: ${{ github.event_name == 'workflow_call' && inputs.config-link-path || '.github/config/md-link-config.json' }} | |
use-verbose-mode: 'yes' | |
- name: Check links (.MD) | |
uses: gaurav-nelson/github-action-markdown-link-check@v1 | |
with: | |
config-file: ${{ github.event_name == 'workflow_call' && inputs.config-link-path || '.github/config/md-link-config.json' }} | |
use-verbose-mode: 'yes' | |
file-extension: '.MD' | |
markdown-spellchecker: | |
if: ${{ (github.event_name == 'workflow_call' && inputs.enable-spell-check) || github.event_name != 'workflow_call' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.REPO_PAT }} | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Update wordlist.txt with users | |
shell: bash | |
run: | | |
export CREDITS=$(gh repo credits) | |
for CREDIT in $CREDITS; | |
do | |
CREDIT=$(printf '%s' "$CREDIT" | sed 's/[0-9]//g') | |
export TEST=$(grep -c $CREDIT .github/config/wordlist.txt) | |
if [ $TEST -eq 0 ]; then | |
echo "not found" | |
echo "$CREDIT" >> .github/config/wordlist.txt | |
else | |
echo "$CREDIT: found" | |
fi | |
done | |
git config --global user.name 'Bot' | |
git config --global user.email '[email protected]' | |
git commit -am "Automated wordlist update with user names" || echo "No changes to commit" | |
git push | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- uses: rojopolis/spellcheck-github-actions@v0 | |
name: Spellcheck | |
with: | |
config_path: .github/config/spellcheck.yml | |
output_file: spellcheck-output.txt | |
task_name: Markdown |