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
13 changes: 13 additions & 0 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,16 @@ run_lint_swift_formatting_for_prs: &run_lint_swift_formatting_for_prs # Swift fo

# Scripts
- "scripts/ci-diagnostics.sh"

run_lint_dprint_for_prs: &run_lint_dprint_for_prs # dprint formatting
- "**/*.yml"
- "**/*.yaml"
- "**/*.json"
- "**/*.md"

# Formatting
- "dprint.json"

# GH Actions
- ".github/workflows/lint-dprint-formatting.yml"
- ".github/file-filters.yml"
49 changes: 35 additions & 14 deletions .github/workflows/lint-dprint-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,8 @@ on:
push:
branches:
- main
paths:
- "**/*.yml"
- "**/*.yaml"
- "**/*.json"
- "**/*.md"
- ".github/workflows/lint-dprint-formatting.yml"
- "dprint.json"

pull_request:
paths:
- "**/*.yml"
- "**/*.yaml"
- "**/*.json"
- "**/*.md"
- ".github/workflows/lint-dprint-formatting.yml"
- "dprint.json"

# Concurrency configuration:
# - We use workflow-specific concurrency groups to prevent multiple lint runs on the same code,
Expand All @@ -37,9 +23,44 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
files-changed:
name: Detect File Changes
runs-on: ubuntu-latest
outputs:
run_lint_dprint_for_prs: ${{ steps.changes.outputs.run_lint_dprint_for_prs }}
steps:
- uses: actions/checkout@v5
- name: Get changed files
id: changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
token: ${{ github.token }}
filters: .github/file-filters.yml

lint:
name: Lint
# Run the job only for PRs with related changes or non-PR events.
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_lint_dprint_for_prs == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dprint/[email protected]

lint-dprint-required-check:
needs:
[
files-changed,
lint,
]
name: Lint dprint
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
if: always()
runs-on: ubuntu-latest
steps:
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
# Skipped jobs are not considered failures.
- name: Check for failures
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "One of the lint dprint jobs has failed." && exit 1
Loading