Skip to content

Commit

Permalink
chore: try python lint
Browse files Browse the repository at this point in the history
  • Loading branch information
spicyfalafel committed Sep 19, 2024
1 parent 590db92 commit 9098247
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,45 @@ on:
- "resources/sdk/**"

jobs:
mark-changed-files:
detect-changes:
runs-on: ubuntu-latest
outputs:
typescript-changed: ${{ steps.detect.outputs.typescript-changed }}
python-changed: ${{ steps.detect.outputs.python-changed }}

steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Set environment variables for changed files
id: set-env
- name: Detect file changes
id: detect
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
# Get the list of changed files
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
echo "Changed files: $CHANGED_FILES"
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
# Check if TypeScript or Python files have changed
if echo "$CHANGED_FILES" | grep -qE '^test/aidbox_sdk/snapshots/typescript/|^resources/sdk/typescript/'; then
echo "typescript-changed=true" >> $GITHUB_ENV
else
echo "typescript-changed=false" >> $GITHUB_ENV
fi
if echo "$CHANGED_FILES" | grep -qE '^test/aidbox_sdk/snapshots/python/|^resources/sdk/python/'; then
echo "python-changed=true" >> $GITHUB_ENV
else
echo "python-changed=false" >> $GITHUB_ENV
fi
- name: Set outputs
id: set-outputs
run: |
echo "typescript-changed=${{ env.typescript-changed }}" >> $GITHUB_ENV
echo "python-changed=${{ env.python-changed }}" >> $GITHUB_ENV
lint-typescript:
needs: mark-changed-files
if: contains(env.CHANGED_FILES, 'test/aidbox_sdk/snapshots/typescript') || contains(env.CHANGED_FILES, 'resources/sdk/typescript')
needs: detect-changes
if: ${{ needs.detect-changes.outputs.typescript-changed == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -50,8 +74,8 @@ jobs:
run: cd test/aidbox_sdk/snapshots/typescript && npm run lint

lint-python:
needs: mark-changed-files
if: contains(env.CHANGED_FILES, 'test/aidbox_sdk/snapshots/python') || contains(env.CHANGED_FILES, 'resources/sdk/python')
needs: detect-changes
if: ${{ needs.detect-changes.outputs.python-changed == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit 9098247

Please sign in to comment.