Skip to content

fix: lint added/modified files only #89

fix: lint added/modified files only

fix: lint added/modified files only #89

Workflow file for this run

---
name: Lint files
# yamllint disable-line rule:truthy
on:
pull_request:
jobs:
default:
uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_linter_callable.yml@main
secrets: inherit
find-changes-for-shell-output:
runs-on: ubuntu-latest
steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
list-files: "shell"
filters: |
markdown:
- added|modified: '**/*.md'
workflow:
- added|modified:
- '.github/workflows/*.yml'
- '.github/workflows/*.yaml'
yaml:
- added|modified:
- '**/*.yaml'
- '**/*.yml'
outputs:
markdown: ${{ steps.changes.outputs.markdown }}
workflow: ${{ steps.changes.outputs.workflow }}
yaml: ${{ steps.changes.outputs.yaml }}
lint-markdown:
runs-on: ubuntu-latest
continue-on-error: true
if: needs.find-changes-for-shell-output.outputs.markdown == 'true'
needs: find-changes-for-shell-output
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Validate Markdown file
run: |
npm install -g markdownlint-cli
# do not check CHANGELOG.md, it is generated automatically
markdownlint -c .config/markdownlint.yml -i CHANGELOG.md ${{ needs.find-changes-for-shell-output.outputs.markdown_files }}
lint-workflow:
runs-on: ubuntu-latest
continue-on-error: true
needs: find-changes-for-shell-output
if: needs.find-changes-for-shell-output.outputs.workflow == 'true'
container:
image: rhysd/actionlint:1.7.0@sha256:5acca218639222e4afbc82fc6e9ef56cbe646ade3b07f3f5ec364b638258a244
options: --cpus 1 --user root
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Validate Github workflows
run: |
mkdir .git
actionlint -color ${{ needs.find-changes-for-shell-output.outputs.workflow_files }}
lint-yaml:
runs-on: ubuntu-latest
continue-on-error: true
needs: find-changes-for-shell-output
if: needs.find-changes-for-shell-output.outputs.yaml == 'true'
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: yaml-lint
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1
with:
config_file: .config/yamllint.yml
file_or_dir: ${{ needs.find-changes-for-shell-output.outputs.yaml_files }}
strict: true