mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-20 14:42:28 +02:00
## Summary - SHA-pins 7 distinct third-party actions across 10 workflow files to full commit SHAs - Prevents supply chain attacks via tag hijacking (mutable tags can be force-pushed by a compromised maintainer account) - Tag retained as an inline comment for readability | Action | Before | After | |--------|--------|-------| | `dorny/paths-filter` | `@v4` | `@fbd0ab8...` | | `Ana06/get-changed-files` | `@v2.3.0` | `@25f79e6...` | | `docker/login-action` | `@v4` | `@b45d80f...` | | `pypa/gh-action-pypi-publish` | `@release/v1` | `@ed0c539...` | | `ncipollo/release-action` | `@v1` | `@339a818...` | | `amannn/action-semantic-pull-request` | `@v6` | `@48f2562...` | | `peter-evans/create-pull-request` | `@v8` | `@c0f553f...` | ## Test plan - [x] CI passes on this PR - [x] Verify each pinned action still functions (no behaviour change, only ref format) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
99 lines
3.7 KiB
YAML
99 lines
3.7 KiB
YAML
name: lint
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
working-directory:
|
|
required: true
|
|
type: string
|
|
description: "From which folder this pipeline executes"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
# This env var allows us to get inline annotations when ruff has complaints.
|
|
RUFF_OUTPUT_FORMAT: github
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
# Only lint on the min and max supported Python versions.
|
|
# It's extremely unlikely that there's a lint issue on any version in between
|
|
# that doesn't show up on the min or max versions.
|
|
#
|
|
# GitHub rate-limits how many jobs can be running at any one time.
|
|
# Starting new jobs is also relatively slow,
|
|
# so linting on fewer versions makes CI faster.
|
|
python-version:
|
|
- "3.12"
|
|
name: "lint #${{ matrix.python-version }}"
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Get changed files
|
|
id: changed-files
|
|
if: github.event_name != 'workflow_dispatch'
|
|
uses: Ana06/get-changed-files@25f79e676e7ea1868813e21465014798211fad8c # v2.3.0
|
|
with:
|
|
filter: "${{ inputs.working-directory }}/**"
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
if: steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch'
|
|
uses: ./.github/actions/uv_setup
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache-suffix: lint-${{ inputs.working-directory }}
|
|
working-directory: ${{ inputs.working-directory }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch'
|
|
working-directory: ${{ inputs.working-directory }}
|
|
run: uv sync --frozen --group lint
|
|
|
|
- name: Get .mypy_cache to speed up mypy
|
|
if: steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch'
|
|
uses: actions/cache@v5
|
|
env:
|
|
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2"
|
|
with:
|
|
path: |
|
|
${{ inputs.working-directory }}/.mypy_cache
|
|
key: mypy-lint-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ inputs.working-directory }}-${{ hashFiles(format('{0}/uv.lock', inputs.working-directory)) }}
|
|
|
|
- name: Analysing package code with our lint
|
|
if: steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch'
|
|
working-directory: ${{ inputs.working-directory }}
|
|
run: |
|
|
if make lint_package > /dev/null 2>&1; then
|
|
make lint_package
|
|
else
|
|
echo "lint_package command not found, using lint instead"
|
|
make lint
|
|
fi
|
|
|
|
- name: Install test dependencies
|
|
if: steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch'
|
|
working-directory: ${{ inputs.working-directory }}
|
|
run: uv sync --group lint
|
|
|
|
- name: Get .mypy_cache_test to speed up mypy
|
|
if: steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch'
|
|
uses: actions/cache@v5
|
|
env:
|
|
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2"
|
|
with:
|
|
path: |
|
|
${{ inputs.working-directory }}/.mypy_cache_test
|
|
key: mypy-test-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ inputs.working-directory }}-${{ hashFiles(format('{0}/uv.lock', inputs.working-directory)) }}
|
|
|
|
- name: Analysing tests with our lint
|
|
if: steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch'
|
|
working-directory: ${{ inputs.working-directory }}
|
|
run: |
|
|
if make lint_tests > /dev/null 2>&1; then
|
|
make lint_tests
|
|
else
|
|
echo "lint_tests command not found, skipping step"
|
|
fi
|