People legislators update ca 2026-09-10-00-03 #9330
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint YAML | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "data/**" | |
| - "settings.yml" | |
| - ".yamllint" | |
| - "uv.lock" | |
| - "pyproject.toml" | |
| - ".github/workflows/lint-yaml.yml" | |
| - ".github/scripts/check_duplicate_people.py" | |
| - ".github/scripts/check_role_dates.py" | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - "data/**" | |
| - "settings.yml" | |
| - ".yamllint" | |
| - "uv.lock" | |
| - "pyproject.toml" | |
| - ".github/workflows/lint-yaml.yml" | |
| - ".github/scripts/check_duplicate_people.py" | |
| - ".github/scripts/check_role_dates.py" | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| # Python & dependency installation | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 | |
| id: changed-dirs | |
| with: | |
| files: data/** | |
| dir_names: 'true' | |
| - uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 | |
| id: changed-files | |
| - name: install uv | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| enable-cache: true | |
| - name: Yaml file linting | |
| run: uvx yamllint==1.38.0 -s . | |
| - name: install dependencies | |
| run: uv sync | |
| - name: lint people selectively | |
| env: | |
| ALL_CHANGED_DIRS: ${{ steps.changed-dirs.outputs.all_changed_files }} | |
| ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| OS_PEOPLE_DIRECTORY: ${{ env.GITHUB_WORKSPACE }} | |
| run: | | |
| # settings.yml holds vacancies used to compute every jurisdiction's | |
| # expected district counts (see Validator/get_expected_districts in | |
| # openstates.utils.people.lint_people). It isn't under data/, so it | |
| # never matches the per-dir regex below - a bad vacancy entry there | |
| # can hide a real missing/extra-legislator error for a jurisdiction | |
| # whose own files didn't change. Lint everything when it changes. | |
| if [[ " ${ALL_CHANGED_FILES} " == *" settings.yml "* ]]; then | |
| echo "settings.yml changed: linting all jurisdictions" | |
| uv run os-people lint | |
| else | |
| abbrs=() | |
| for dir in ${ALL_CHANGED_DIRS}; do | |
| if [[ "$dir" =~ ^data/([a-z]{2})/(legislature|retired|executive|municipalities) ]]; then | |
| abbrs+=("${BASH_REMATCH[1]}") | |
| fi | |
| done | |
| if [[ ${#abbrs[@]} -gt 0 ]]; then | |
| mapfile -t abbrs < <(printf '%s\n' "${abbrs[@]}" | sort -u) | |
| uv run os-people lint "${abbrs[@]}" | |
| fi | |
| fi | |
| - name: resolve base revision | |
| id: base | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} | |
| run: | | |
| # The two checks below report only what this change introduced. Both | |
| # describe a bot mistake being made, so a long-standing one in a file | |
| # the change merely reformats is not this author's to fix - see | |
| # check_role_dates.py's module docstring. Without a usable base they | |
| # report everything, which is noisy but never misses a real problem. | |
| empty_sha=0000000000000000000000000000000000000000 | |
| if [[ -n "${BASE_SHA}" && "${BASE_SHA}" != "${empty_sha}" ]]; then | |
| # actions/checkout clones at depth 1, so the base commit is usually | |
| # absent locally; fetch just that one commit. | |
| git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null \ | |
| || git fetch --no-tags --depth=1 origin "${BASE_SHA}" \ | |
| || true | |
| if git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then | |
| echo "base-args=--base-ref ${BASE_SHA}" >> "${GITHUB_OUTPUT}" | |
| exit 0 | |
| fi | |
| echo "base ${BASE_SHA} unavailable: reporting all findings" | |
| fi | |
| echo "base-args=" >> "${GITHUB_OUTPUT}" | |
| - name: check duplicate people selectively | |
| env: | |
| ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| BASE_ARGS: ${{ steps.base.outputs.base-args }} | |
| run: | | |
| uv run python .github/scripts/check_duplicate_people.py \ | |
| --changed-files ${ALL_CHANGED_FILES} ${BASE_ARGS} | |
| - name: check role date integrity selectively | |
| env: | |
| ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| BASE_ARGS: ${{ steps.base.outputs.base-args }} | |
| run: | | |
| uv run python .github/scripts/check_role_dates.py \ | |
| --changed-files ${ALL_CHANGED_FILES} ${BASE_ARGS} | |
| - name: lint committees selectively | |
| env: | |
| OS_PEOPLE_DIRECTORY: ${{ env.GITHUB_WORKSPACE }} | |
| ALL_CHANGED_DIRS: ${{ steps.changed-dirs.outputs.all_changed_files }} | |
| run: | | |
| abbrs=() | |
| for dir in ${ALL_CHANGED_DIRS}; do | |
| if [[ "$dir" =~ ^data/([a-z]{2})/committees ]]; then | |
| abbrs+=("${BASH_REMATCH[1]}") | |
| fi | |
| done | |
| if [[ ${#abbrs[@]} -gt 0 ]]; then | |
| mapfile -t abbrs < <(printf '%s\n' "${abbrs[@]}" | sort -u) | |
| uv run os-committees lint "${abbrs[@]}" | |
| fi |