Fix: More Path Filters (#1443)

* fix: add more path filters and remove check path action

* feat: only run on changes to pyproject.toml / package.json

* fix: try bumping golangci-lint

* fix: golang ci config

* fix: upgrade pre commit ver

* Revert "fix: upgrade pre commit ver"

This reverts commit 9cdbfc68da.

* Revert "fix: golang ci config"

This reverts commit 6b27c1abd0.

* Revert "fix: try bumping golangci-lint"

This reverts commit f7bfcb6963.
This commit is contained in:
Matt Kaye
2025-03-28 11:16:56 -04:00
committed by GitHub
parent 5eec4a7bea
commit 3dc45e4bb1
8 changed files with 4 additions and 214 deletions

View File

@@ -1,90 +0,0 @@
name: 'Check Changed Paths'
description: 'Check if changed files match specified patterns'
inputs:
include_patterns:
description: 'Patterns to include, one per line'
required: false
default: ''
exclude_patterns:
description: 'Patterns to exclude, one per line'
required: false
default: ''
result_name:
description: 'Name for the output result'
required: false
default: 'match_only'
outputs:
match_result:
description: "true if all changed files match include patterns and don't match exclude patterns"
value: ${{ steps.check-paths.outputs.result }}
runs:
using: 'composite'
steps:
- name: Check changed paths
id: check-paths
shell: bash
run: |
# Get list of changed files
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target" ]]; then
echo "PR context detected, comparing against base branch"
# Fetch the base branch first to ensure we have history
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1
CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }} ||
git diff --name-only origin/${{ github.event.pull_request.base.ref }}..HEAD ||
git diff --name-only HEAD)
else
echo "Non-PR context detected, comparing against previous commit"
# For push events, try to get changed files using more reliable methods
CHANGED_FILES=$(git diff --name-only HEAD^ ||
git diff --name-only HEAD~1 ||
git show --name-only --format="" ||
echo "")
fi
if [[ -z "$CHANGED_FILES" ]]; then
echo "Warning: Could not determine changed files. Treating all files as changed."
CHANGED_FILES=$(find . -type f -not -path "./.git/*" | sed 's|^./||')
fi
echo "Changed files: $CHANGED_FILES"
# Default to true - will change to false if any file doesn't match criteria
RESULT=true
# Convert input patterns to arrays
IFS=$'\n' read -r -a INCLUDE_PATTERNS <<< "${{ inputs.include_patterns }}"
IFS=$'\n' read -r -a EXCLUDE_PATTERNS <<< "${{ inputs.exclude_patterns }}"
# Process each changed file
for file in $CHANGED_FILES; do
# Check if file matches any include pattern (if provided)
if [[ ${#INCLUDE_PATTERNS[@]} -gt 0 ]]; then
INCLUDED=false
for pattern in "${INCLUDE_PATTERNS[@]}"; do
if [[ -n "$pattern" && "$file" =~ $pattern ]]; then
INCLUDED=true
break
fi
done
if [[ "$INCLUDED" == "false" ]]; then
echo "File '$file' doesn't match any include pattern"
RESULT=false
break
fi
fi
# Check if file matches any exclude pattern (if provided)
if [[ ${#EXCLUDE_PATTERNS[@]} -gt 0 ]]; then
for pattern in "${EXCLUDE_PATTERNS[@]}"; do
if [[ -n "$pattern" && "$file" =~ $pattern ]]; then
echo "File '$file' matches exclude pattern: $pattern"
RESULT=false
break 2
fi
done
fi
done
echo "result=$RESULT" >> $GITHUB_OUTPUT
echo "${{ inputs.result_name }}=$RESULT" >> $GITHUB_OUTPUT
echo "Final result: $RESULT"

View File

@@ -1,26 +1,12 @@
name: "frontend / app"
on:
pull_request:
paths:
- "frontend/app/**"
jobs:
check_path:
runs-on: ubuntu-latest
outputs:
sdk_only: ${{ steps.filter.outputs.sdk_only }}
steps:
- uses: actions/checkout@v4
- name: Check if only SDK files changed
id: check-paths
uses: ./.github/actions/check-paths
with:
include_patterns: |
^sdks/
result_name: sdk_only
lint:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -42,9 +28,7 @@ jobs:
run: npm run lint:check
build:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4

View File

@@ -6,24 +6,8 @@ on:
- 'frontend/docs/**'
jobs:
check_path:
runs-on: ubuntu-latest
outputs:
sdk_only: ${{ steps.filter.outputs.sdk_only }}
steps:
- uses: actions/checkout@v4
- name: Check if only SDK files changed
id: check-paths
uses: ./.github/actions/check-paths
with:
include_patterns: |
^sdks/
result_name: sdk_only
frontend:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -31,9 +15,7 @@ jobs:
run: docker build -f ./build/package/frontend.dockerfile .
api:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -41,9 +23,7 @@ jobs:
run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=api
api-arm:
needs: check_path
runs-on: hatchet-arm64-2
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -51,9 +31,7 @@ jobs:
run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=api
engine:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -61,9 +39,7 @@ jobs:
run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=engine
engine-arm:
needs: check_path
runs-on: hatchet-arm64-2
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -71,9 +47,7 @@ jobs:
run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=engine
admin:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -81,9 +55,7 @@ jobs:
run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=admin
admin-arm:
needs: check_path
runs-on: hatchet-arm64-2
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -91,9 +63,7 @@ jobs:
run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=admin
migrate:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -101,9 +71,7 @@ jobs:
run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=migrate
migrate-arm:
needs: check_path
runs-on: hatchet-arm64-2
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -111,9 +79,7 @@ jobs:
run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=migrate
lite-arm:
needs: check_path
runs-on: hatchet-arm64-2
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -147,9 +113,7 @@ jobs:
.
lite-amd:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -183,9 +147,7 @@ jobs:
.
dashboard-arm:
needs: check_path
runs-on: hatchet-arm64-2
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -203,9 +165,7 @@ jobs:
.
dashboard-amd:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -223,9 +183,7 @@ jobs:
.
loadtest:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -233,9 +191,7 @@ jobs:
run: docker build -f ./build/package/loadtest.dockerfile .
loadtest-arm:
needs: check_path
runs-on: hatchet-arm64-2
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4

View File

@@ -5,24 +5,8 @@ on:
- 'frontend/docs/**'
jobs:
check_path:
runs-on: ubuntu-latest
outputs:
sdk_only: ${{ steps.filter.outputs.sdk_only }}
steps:
- uses: actions/checkout@v4
- name: Check if only SDK files changed
id: check-paths
uses: ./.github/actions/check-paths
with:
include_patterns: |
^sdks/
result_name: sdk_only
lint:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4
@@ -44,9 +28,7 @@ jobs:
run: npm run lint:check
build:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- name: Clone repository
uses: actions/checkout@v4

View File

@@ -3,26 +3,8 @@ on:
pull_request:
jobs:
check_path:
runs-on: ubuntu-latest
outputs:
sdk_only: ${{ steps.check-paths.outputs.sdk_only }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Need full history for comparing with base branch
- name: Check if only SDK files changed
id: check-paths
uses: ./.github/actions/check-paths
with:
include_patterns: |
^sdks/
result_name: sdk_only
lint:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

View File

@@ -11,7 +11,7 @@ on:
branches:
- main
paths:
- 'sdks/python/**'
- 'sdks/python/pyproject.toml'
defaults:
run:

View File

@@ -11,7 +11,7 @@ on:
branches:
- main
paths:
- 'sdks/typescript/**'
- 'sdks/typescript/package.json'
defaults:
run:

View File

@@ -6,24 +6,8 @@ on:
- 'frontend/docs/**'
jobs:
check_path:
runs-on: ubuntu-latest
outputs:
sdk_only: ${{ steps.filter.outputs.sdk_only }}
steps:
- uses: actions/checkout@v4
- name: Check if only SDK files changed
id: check-paths
uses: ./.github/actions/check-paths
with:
include_patterns: |
^sdks/
result_name: sdk_only
generate:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
env:
DATABASE_URL: postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet?sslmode=disable
@@ -69,9 +53,7 @@ jobs:
run: docker compose down
unit:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
@@ -89,9 +71,7 @@ jobs:
run: go test ./... -v -failfast
integration:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
env:
DATABASE_URL: postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet?sslmode=disable
@@ -135,9 +115,7 @@ jobs:
run: docker compose down
e2e:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
timeout-minutes: 30
env:
DATABASE_URL: postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet?sslmode=disable
@@ -224,9 +202,7 @@ jobs:
run: docker compose down
e2e-pgmq:
needs: check_path
runs-on: ubuntu-latest
if: ${{ needs.check_path.outputs.sdk_only != 'true' }}
timeout-minutes: 30
env:
DATABASE_URL: postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet?sslmode=disable