diff --git a/.github/workflows/squad-standard-lint-markdown.yml b/.github/workflows/squad-standard-lint-markdown.yml index bd14e5c..afa982f 100644 --- a/.github/workflows/squad-standard-lint-markdown.yml +++ b/.github/workflows/squad-standard-lint-markdown.yml @@ -9,15 +9,25 @@ jobs: lint-markdown: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 + with: + fetch-depth: 0 - uses: actions/setup-node@v5 with: node-version: "22" - name: Run markdownlint run: | - files=$(git ls-files '*.md') + if [ "${{ github.event_name }}" = "pull_request" ]; then + base_ref="origin/${{ github.base_ref }}" + git fetch --no-tags --depth=1 origin "${{ github.base_ref }}" + files=$(git diff --name-only "${base_ref}...HEAD" -- '*.md' | tr '\n' ' ') + else + files=$(git ls-files '*.md' | tr '\n' ' ') + fi + if [ -z "$files" ]; then - echo "No markdown files found." + echo "No markdown files to lint." exit 0 fi - npx --yes markdownlint-cli $files + + npx --yes markdownlint-cli2 $files diff --git a/.github/workflows/squad-standard-lint-yaml.yml b/.github/workflows/squad-standard-lint-yaml.yml index b8049c0..01af219 100644 --- a/.github/workflows/squad-standard-lint-yaml.yml +++ b/.github/workflows/squad-standard-lint-yaml.yml @@ -9,16 +9,27 @@ jobs: lint-yaml: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 + with: + fetch-depth: 0 - uses: actions/setup-python@v6 with: python-version: "3.x" - name: Run yamllint run: | python -m pip install --quiet yamllint - files=$(git ls-files '*.yml' '*.yaml') + + if [ "${{ github.event_name }}" = "pull_request" ]; then + base_ref="origin/${{ github.base_ref }}" + git fetch --no-tags --depth=1 origin "${{ github.base_ref }}" + files=$(git diff --name-only "${base_ref}...HEAD" -- '*.yml' '*.yaml' | tr '\n' ' ') + else + files=$(git ls-files '*.yml' '*.yaml' | tr '\n' ' ') + fi + if [ -z "$files" ]; then - echo "No YAML files found." + echo "No YAML files to lint." exit 0 fi + yamllint -s $files