mirror of
https://github.com/hwchase17/langchain.git
synced 2026-07-12 11:21:37 +00:00
Adds `github.repository_owner == 'langchain-ai'` guards to 14 GitHub
Actions workflows that were missing them. Without these guards,
write-capable automation (issue/PR labeling, closing, commenting, PR
reopening, release publishing) and CI jobs fire on forks — causing
unwanted mutations, wasted runner minutes, and failed GitHub App token
generation on repos that don't have the required secrets.
Also removes `v03_api_doc_build.yml`, which pushed built docs to
`langchain-ai/langchain-api-docs-html` via `TOKEN_GITHUB_API_DOCS_HTML`
— a secret that isn't set on this repo. The workflow was dead code with
no consumers.
---
## What changed
**Write-capable workflows now guarded** (8 files):
- `auto-label-by-package` — was adding/removing issue labels on forks
- `close_unchecked_issues` — was closing issues and posting comments on
forks via GitHub App token
- `tag-external-issues` — both `tag-external` and `backfill` jobs were
generating App tokens and labeling issues on forks
- `reopen_on_assignment` — was reopening PRs and re-running workflows on
forks
- `require_issue_link` — was closing PRs, creating labels, posting
comments, and canceling workflow runs on forks
- `remove_waiting_on_author` — was removing labels on fork issues/PRs
- `pr_labeler` — was generating App tokens and adding/removing PR labels
on forks
- `pr_labeler_backfill` — same, on manual trigger from a fork
**Read-only CI workflows now guarded** (5 files):
- `check_diffs` — `build` and `check-release-options` jobs (downstream
jobs inherit the skip)
- `codspeed` — `build` job
- `check_agents_sync`, `check_versions`, `check_release_deps`
**Release workflow guarded** (1 file):
- `_release` — `build` job (all downstream jobs chain via `needs`, so
they inherit the skip). Previously relied only on `environment: Release`
approval and a `github.ref` check.
**Removed**:
- `v03_api_doc_build.yml` — dead workflow depending on unset
`TOKEN_GITHUB_API_DOCS_HTML` secret
## What was already guarded
`block_fork_main_prs`, `bump_uv_pin`, `check_extras_sync`,
`integration_tests`, `pr_lint_trailer`, `refresh_model_profiles` already
had the guard. `pr_lint` (read-only, `pull-requests: read`) and the
`_*.yml` reusable workflows (only run when called by a guarded parent)
were intentionally left unguarded.
## Release note
- GitHub Actions workflows now skip execution on forks via
`repository_owner == 'langchain-ai'` guards, preventing unwanted
issue/PR automation and CI runs outside the canonical repo.
- Removed the dead `v03_api_doc_build` workflow that depended on an
unset secret.
---
🤖 Generated with AI-agent involvement.
56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
# Ensures version numbers in pyproject.toml and _version.py stay in sync.
|
|
#
|
|
# (Prevents releases with mismatched version numbers)
|
|
|
|
name: "Check Version Equality"
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "libs/core/pyproject.toml"
|
|
- "libs/core/langchain_core/version.py"
|
|
- "libs/langchain_v1/pyproject.toml"
|
|
- "libs/langchain_v1/langchain/__init__.py"
|
|
- "libs/partners/*/pyproject.toml"
|
|
- "libs/partners/**/_version.py"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check_version_equality:
|
|
if: github.repository_owner == 'langchain-ai'
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
|
|
|
|
- uses: astral-sh/setup-uv@0ca8f610542aa7f4acaf39e65cf4eb3c35091883 # v7
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: "Verify pyproject.toml & version files match"
|
|
run: |
|
|
FAILED=0
|
|
|
|
for dir in libs/core libs/langchain_v1 libs/partners/*; do
|
|
[ -f "$dir/Makefile" ] || continue
|
|
if grep -q '^check_version:' "$dir/Makefile"; then
|
|
echo "--- $dir ---"
|
|
make -C "$dir" check_version || FAILED=1
|
|
elif find "$dir" -maxdepth 2 -name '_version.py' -not -path '*/tests/*' \
|
|
| grep -q .; then
|
|
# A package ships a _version.py but has no way to verify it stays
|
|
# in sync with pyproject.toml. Don't let it pass unchecked.
|
|
echo "--- $dir ---"
|
|
echo "Error: $dir has a _version.py but no 'check_version' Makefile target"
|
|
FAILED=1
|
|
fi
|
|
done
|
|
|
|
if [ "$FAILED" -ne 0 ]; then
|
|
echo ""
|
|
echo "One or more version checks failed!"
|
|
exit 1
|
|
fi
|