Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wfh/action3 #198188

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/workflows/langgraph_cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Update langgraph-cli

on:
workflow_dispatch:

permissions:
contents: write

jobs:
regenerate:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

Check failure on line 13 in .github/workflows/langgraph_cli.yml

View workflow job for this annotation

GitHub Actions / workflow_syntax

the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

- name: Create a fresh virtual environment and generate formula
run: |

Check failure on line 16 in .github/workflows/langgraph_cli.yml

View workflow job for this annotation

GitHub Actions / workflow_syntax

shellcheck reported issue in this script: SC2102:info:4:32: Ranges can only match single chars (mentioned due to duplicates)
python3 -m pip install -U uv
uv venv
source .venv/bin/activate
uv pip install -U langgraph-cli[inmem] debugpy homebrew-pypi-poet
poet -f langgraph-cli > Formula/l/langgraph-cli.rb
deactivate
rm -rf .venv

- name: Replace description and test
run: |
python3 -m venv .venv
source .venv/bin/activate
python3 << 'EOL'
import re

with open('Formula/l/langgraph-cli.rb', 'r') as f:
content = f.read()

# Update description
content = re.sub(
r'desc \"Shiny new formula\"',
'desc \"Command-line interface for deploying apps to the LangGraph platform\"',
content
)

# Add license
content = re.sub(
r'sha256 \".*?\"',
'sha256 \"210eea115772df982408366b0aad06d226e6ea3752e8784c3ce99f388b2d07c9\"\n license \"MIT\"',
content
)

# Add bottle block
bottle_block = '''
bottle do
sha256 cellar: :any_skip_relocation, all: \"0f1a7595670629ddfb8841df53da419f788c2423f81d72119a2e366f52a8fa7c\"
end
'''
content = re.sub(r'(license \"MIT\"\n)', f'\\1\n{bottle_block}', content)

# Update Python dependency
content = re.sub(r'depends_on \"python3\"', 'depends_on \"[email protected]\"', content)

# Update install method
content = re.sub(
r'def install.*?end',
'def install\n virtualenv_install_with_resources\n end',
content,
flags=re.DOTALL
)

# Update test block
test_block = '''
test do
(testpath/"graph.py").write <<~PYTHON
from langgraph.graph import StateGraph
builder = StateGraph(list)
builder.add_node("anode", lambda x: ["foo"])
builder.add_edge("__start__", "anode")
graph = builder.compile()
PYTHON

(testpath/"langgraph.json").write <<~JSON
{
"graphs": {
"agent": "graph.py:graph"
},
"env": {},
"dependencies": ["."]
}
JSON

system bin/"langgraph", "dockerfile", "DOCKERFILE"
assert_path_exists "DOCKERFILE"
dockerfile_content = File.read("DOCKERFILE")
assert_match "FROM", dockerfile_content, "DOCKERFILE should contain 'FROM'"
end
'''
content = re.sub(r'test do.*?end', test_block, content, flags=re.DOTALL)

with open('Formula/l/langgraph-cli.rb', 'w') as f:
f.write(content)
EOL
deactivate
rm -rf .venv
echo "Updated formula contents:"
cat Formula/l/langgraph-cli.rb

- name: Commit and push
run: |
git config user.name "Automated"
git config user.email "[email protected]"
git add Formula/l/langgraph-cli.rb
timestamp=$(date -u)
git commit -m "Update langgraph-cli: ${timestamp}" || exit 0
git pull --rebase origin main || {
echo "Failed to rebase, please check manually"
exit 1
}
git push origin HEAD || {
echo "Failed to push changes, please check manually"
exit 1
}
24 changes: 24 additions & 0 deletions Formula/l/langgraph-cli.tmp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class LanggraphCli < Formula
include Language::Python::Virtualenv

desc "Shiny new formula"
homepage "https://www.github.com/langchain-ai/langgraph"
url "https://files.pythonhosted.org/packages/13/f4/e60c465ddc4d6fbfd6a9c002bbd491a747b4cbfa92db0e5c76245bfd5c97/langgraph_cli-0.1.52.tar.gz"
sha256 "210eea115772df982408366b0aad06d226e6ea3752e8784c3ce99f388b2d07c9"

depends_on "python3"

resource "click" do
url "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz"
sha256 "ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"
end

def install
virtualenv_create(libexec, "python3")
virtualenv_install_with_resources
end

test do
false
end
end
Loading