3232 required : false
3333 type : boolean
3434 default : true
35- auto_merge_hash_history :
36- description : " Create PR to merge hash history back to main. Set to false when not running from main."
37- required : false
38- type : boolean
39- default : true
4035 schedule :
4136 # Run job at 00:00 UTC (4:00 PM PST / 5:00 PM PDT)
4237 - cron : " 0 0 * * *"
@@ -181,90 +176,6 @@ jobs:
181176 exit 1
182177 fi
183178
184- build-hash-history :
185- if : github.repository == 'langflow-ai/langflow'
186- name : Build Nightly Hash History
187- needs : create-nightly-tag
188- runs-on : ubuntu-latest
189- defaults :
190- run :
191- shell : bash -ex -o pipefail {0}
192- permissions :
193- contents : write
194- steps :
195- - name : Checkout nightly tag
196- uses : actions/checkout@v6
197- with :
198- ref : ${{ needs.create-nightly-tag.outputs.main_tag }}
199- persist-credentials : true
200-
201- - name : " Setup Environment"
202- uses : astral-sh/setup-uv@v6
203- with :
204- enable-cache : true
205- cache-dependency-glob : " uv.lock"
206- python-version : ${{ env.PYTHON_VERSION }}
207- prune-cache : false
208-
209- - name : Install the project
210- run : uv sync
211-
212- - name : Force reinstall LFX to pick up version change
213- run : |
214- echo "Force reinstalling lfx-nightly to ensure version metadata is updated..."
215- uv pip install --reinstall --no-deps src/lfx
216-
217- - name : Verify LFX version
218- run : |
219- echo "Checking installed LFX version..."
220- uv run python -c "from importlib.metadata import version; print(f'lfx-nightly version: {version(\"lfx-nightly\")}')" || \
221- uv run python -c "from importlib.metadata import version; print(f'lfx version: {version(\"lfx\")}')"
222-
223- - name : Build and validate nightly hash history
224- run : |
225- # The script includes append-only validation
226- uv run python scripts/build_hash_history.py --nightly
227-
228- - name : Commit and push hash history changes
229- run : |
230- echo "=== Configuring git ==="
231- git config --global user.email "bot-nightly-builds@langflow.org"
232- git config --global user.name "Langflow Bot"
233-
234- echo "=== Checking for hash history changes ==="
235- # Check if there are changes to commit (handles if it's a new file for first run)
236- git add src/lfx/src/lfx/_assets/nightly_hash_history.json
237- if git diff --cached --quiet src/lfx/src/lfx/_assets/nightly_hash_history.json; then
238- echo "No changes to nightly hash history"
239- else
240- echo "Hash history changes detected, committing..."
241- # Commit to the nightly tag itself so builds include the hash history
242- git commit -m "Update nightly hash history for ${{ needs.create-nightly-tag.outputs.main_tag }}"
243-
244- echo "=== Updating nightly tag ${{ needs.create-nightly-tag.outputs.main_tag }} ==="
245- # Update the tag to include the hash history
246- git tag -f ${{ needs.create-nightly-tag.outputs.main_tag }}
247- git push -f origin ${{ needs.create-nightly-tag.outputs.main_tag }}
248-
249- echo "=== Creating clean branch from main with only hash history changes ==="
250- # Fetch latest main
251- git fetch origin main
252-
253- # Create a new branch from main
254- git checkout -B nightly-hash-history-updates origin/main
255-
256- # Copy ONLY the hash history file from the nightly tag
257- git checkout ${{ needs.create-nightly-tag.outputs.main_tag }} -- src/lfx/src/lfx/_assets/nightly_hash_history.json
258-
259- # Commit only this file
260- git add src/lfx/src/lfx/_assets/nightly_hash_history.json
261- git commit -m "Update nightly hash history for ${{ needs.create-nightly-tag.outputs.main_tag }}"
262-
263- # Force push the clean branch
264- git push origin nightly-hash-history-updates --force
265- echo "Updated nightly tag and created clean branch with only hash history changes"
266- fi
267-
268179 frontend-tests :
269180 if : github.repository == 'langflow-ai/langflow' && !inputs.skip_frontend_tests
270181 name : Run Frontend Tests
@@ -304,9 +215,9 @@ jobs:
304215 # ref: ${{ needs.create-nightly-tag.outputs.tag }}
305216
306217 release-nightly-build :
307- if : github.repository == 'langflow-ai/langflow' && always() && needs.frontend-tests.result != 'failure' && needs.backend-unit-tests.result != 'failure' && needs.build-hash-history.result != 'failure'
218+ if : github.repository == 'langflow-ai/langflow' && always() && needs.frontend-tests.result != 'failure' && needs.backend-unit-tests.result != 'failure'
308219 name : Run Nightly Langflow Build
309- needs : [create-nightly-tag, frontend-tests, backend-unit-tests, build-hash-history ]
220+ needs : [create-nightly-tag, frontend-tests, backend-unit-tests]
310221 uses : ./.github/workflows/release_nightly.yml
311222 with :
312223 build_docker_base : true
@@ -323,12 +234,12 @@ jobs:
323234
324235 slack-notification :
325236 name : Send Slack Notification
326- needs : [frontend-tests, backend-unit-tests, release-nightly-build, merge-hash-history-to-main ]
327- if : ${{ github.repository == 'langflow-ai/langflow' && !inputs.skip_slack && always() && (needs.release-nightly-build.result == 'failure' || needs.frontend-tests.result == 'failure' || needs.backend-unit-tests.result == 'failure' || needs.merge-hash-history-to-main.result == 'failure' || needs. release-nightly-build.result == 'success') }}
237+ needs : [frontend-tests, backend-unit-tests, release-nightly-build]
238+ if : ${{ github.repository == 'langflow-ai/langflow' && !inputs.skip_slack && always() && (needs.release-nightly-build.result == 'failure' || needs.frontend-tests.result == 'failure' || needs.backend-unit-tests.result == 'failure' || needs.release-nightly-build.result == 'success') }}
328239 runs-on : ubuntu-latest
329240 steps :
330241 - name : Send failure notification to Slack
331- if : ${{ needs.release-nightly-build.result == 'failure' || needs.frontend-tests.result == 'failure' || needs.backend-unit-tests.result == 'failure' || needs.merge-hash-history-to-main.result == 'failure' }}
242+ if : ${{ needs.release-nightly-build.result == 'failure' || needs.frontend-tests.result == 'failure' || needs.backend-unit-tests.result == 'failure' }}
332243 run : |
333244 # Determine which job failed
334245 FAILED_JOB="unknown"
@@ -338,8 +249,6 @@ jobs:
338249 FAILED_JOB="frontend-tests"
339250 elif [ "${{ needs.backend-unit-tests.result }}" == "failure" ]; then
340251 FAILED_JOB="backend-unit-tests"
341- elif [ "${{ needs.merge-hash-history-to-main.result }}" == "failure" ]; then
342- FAILED_JOB="merge-hash-history-to-main"
343252 fi
344253
345254 curl -X POST -H 'Content-type: application/json' \
@@ -377,157 +286,6 @@ jobs:
377286 ]
378287 }" ${{ secrets.LANGFLOW_ENG_SLACK_WEBHOOK_URL }}
379288
380- merge-hash-history-to-main :
381- name : Create PR to Merge Hash History to Main
382- needs : [create-nightly-tag, build-hash-history, release-nightly-build]
383- # Run if auto_merge_hash_history is true (default) or not set (scheduled runs)
384- # When triggered by schedule, inputs.auto_merge_hash_history is not set, so default to true
385- # Only run when the base branch is 'main' to prevent PRs from feature branches
386- if : github.repository == 'langflow-ai/langflow' && github.ref == 'refs/heads/main' && always() && needs.build-hash-history.result == 'success' && needs.release-nightly-build.result == 'success' && (github.event_name == 'schedule' || inputs.auto_merge_hash_history != false)
387- runs-on : ubuntu-latest
388- permissions :
389- contents : write
390- pull-requests : write
391- steps :
392- - name : Checkout main branch
393- uses : actions/checkout@v6
394- with :
395- ref : main
396- fetch-depth : 0
397- persist-credentials : true
398-
399- - name : Configure Git
400- run : |
401- git config --global user.email "bot-nightly-builds@langflow.org"
402- git config --global user.name "Langflow Bot"
403-
404- - name : " Setup Environment"
405- uses : astral-sh/setup-uv@v6
406- with :
407- enable-cache : true
408- cache-dependency-glob : " uv.lock"
409- python-version : ${{ env.PYTHON_VERSION }}
410- prune-cache : false
411-
412- - name : Fetch nightly hash history branch
413- run : |
414- echo "=== Fetching nightly-hash-history-updates branch ==="
415- git fetch origin nightly-hash-history-updates || true
416- echo "Fetch completed"
417-
418- - name : Check if branch exists and has changes
419- id : check_branch
420- run : |
421- echo "=== Checking branch status ==="
422- if git rev-parse --verify origin/nightly-hash-history-updates >/dev/null 2>&1; then
423- echo "branch_exists=true" >> $GITHUB_OUTPUT
424- echo "Branch exists"
425-
426- # Check if there are differences between main and the nightly branch
427- echo "=== Comparing with main branch ==="
428- if git diff --quiet main origin/nightly-hash-history-updates -- src/lfx/src/lfx/_assets/nightly_hash_history.json; then
429- echo "has_changes=false" >> $GITHUB_OUTPUT
430- echo "No changes to merge"
431- else
432- echo "has_changes=true" >> $GITHUB_OUTPUT
433- echo "Changes detected - PR will be created/updated"
434- fi
435- else
436- echo "branch_exists=false" >> $GITHUB_OUTPUT
437- echo "has_changes=false" >> $GITHUB_OUTPUT
438- echo "ERROR: Branch nightly-hash-history-updates does not exist!"
439- echo "This should have been created by the build-hash-history job."
440- exit 1
441- fi
442-
443- - name : Validate and prepare PR
444- if : steps.check_branch.outputs.branch_exists == 'true' && steps.check_branch.outputs.has_changes == 'true'
445- run : |
446- echo "=== Checking out hash history file from nightly branch ==="
447- # Checkout the nightly hash history file to verify it
448- git checkout origin/nightly-hash-history-updates -- src/lfx/src/lfx/_assets/nightly_hash_history.json
449-
450- echo "=== Verifying only hash history file was modified ==="
451- # Verify that ONLY the nightly_hash_history.json file was modified
452- CHANGED_FILES=$(git diff --name-only main)
453- if [ "$CHANGED_FILES" != "src/lfx/src/lfx/_assets/nightly_hash_history.json" ]; then
454- echo "ERROR: Unexpected files were modified: $CHANGED_FILES"
455- echo "Only nightly_hash_history.json should be changed"
456- exit 1
457- fi
458- echo "Only hash history file modified"
459-
460- echo "=== Validating hash history file ==="
461- # Basic validation - ensure file exists and is valid JSON
462-
463- if [ ! -f "src/lfx/src/lfx/_assets/nightly_hash_history.json" ]; then
464- echo "ERROR: nightly_hash_history.json file was deleted!"
465- exit 1
466- fi
467-
468- if ! uv run python -c "import json; json.load(open('src/lfx/src/lfx/_assets/nightly_hash_history.json'))"; then
469- echo "ERROR: nightly_hash_history.json is not valid JSON!"
470- exit 1
471- fi
472-
473- echo "Hash history file validation passed"
474- echo "Note: Append-only validation was performed during the build step"
475-
476- - name : Create Pull Request
477- if : steps.check_branch.outputs.branch_exists == 'true' && steps.check_branch.outputs.has_changes == 'true'
478- env :
479- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
480- PR_BODY : >-
481- This PR updates the nightly hash history file with the latest component hashes from the nightly build.
482-
483-
484- **Automated PR** - Generated by nightly build workflow
485-
486-
487- - Updates: `src/lfx/src/lfx/_assets/nightly_hash_history.json`
488-
489- - Source: Nightly build tag ${{ needs.create-nightly-tag.outputs.main_tag || 'latest nightly' }}
490-
491-
492- This PR is automatically updated each night with the latest hash history.
493-
494- Auto-merge is enabled - PR will merge automatically when checks pass.
495- run : |
496- echo "=== Creating or updating PR ==="
497-
498- # Check if PR already exists
499- EXISTING_PR=$(gh pr list --head nightly-hash-history-updates --base main --json number --jq '.[0].number' 2>/dev/null || echo "")
500-
501- if [ -n "$EXISTING_PR" ]; then
502- echo "PR #$EXISTING_PR already exists, updating..."
503- gh pr edit "$EXISTING_PR" \
504- --title "chore: update nightly hash history" \
505- --body "$PR_BODY"
506-
507- echo "PR updated successfully"
508- PR_NUMBER="$EXISTING_PR"
509- else
510- echo "Creating new PR..."
511- PR_URL=$(gh pr create \
512- --title "chore: update nightly hash history" \
513- --body "$PR_BODY" \
514- --base main \
515- --head nightly-hash-history-updates)
516-
517- echo "PR created: $PR_URL"
518- # Extract PR number from URL (works with both formats)
519- PR_NUMBER=$(echo "$PR_URL" | sed 's/.*\/pull\///' | sed 's/[^0-9].*//')
520- fi
521-
522- # Enable auto-merge on the PR
523- echo "=== Enabling auto-merge ==="
524- if gh pr merge "$PR_NUMBER" --auto --squash; then
525- echo "Auto-merge enabled successfully"
526- else
527- echo "ERROR: Could not enable auto-merge on PR"
528- # TODO: Fail the job here (once you've got everything working on happy path)
529- fi
530-
531289 - name : Send success notification to Slack
532290 if : ${{ !inputs.skip_slack && needs.release-nightly-build.result == 'success' }}
533291 run : |
0 commit comments