@@ -46,54 +46,85 @@ concurrency:
4646
4747jobs :
4848 check-nightly-status :
49- name : Check Nightly Status
49+ name : Check PyPI Version Update
5050 runs-on : ubuntu-latest
5151 outputs :
52- should-proceed : ${{ steps.check-workflow .outputs.success }}
52+ should-proceed : ${{ steps.check-pypi .outputs.success }}
5353 steps :
54- - name : Check nightly workflow status
55- id : check-workflow
56- uses : actions/github-script@v7
57- with :
58- script : |
59- const workflow_name = 'nightly_build.yml';
60- const today = new Date();
61- today.setHours(0, 0, 0, 0); // Set to beginning of day
62-
63- const { data: runs } = await github.rest.actions.listWorkflowRuns({
64- owner: context.repo.owner,
65- repo: context.repo.repo,
66- workflow_id: workflow_name,
67- created: `>=${today.toISOString()}`,
68- per_page: 100, // Get more runs to check
69- status: 'completed'
70- });
71-
72- if (runs.workflow_runs.length === 0) {
73- console.log('No completed workflow runs found today');
74- return core.setOutput('success', 'true');
75- }
76-
77- // Check if any runs today were successful
78- const successfulTodayRuns = runs.workflow_runs.filter(run => run.conclusion === 'success');
79- const hasSuccessfulRunToday = successfulTodayRuns.length > 0;
80-
81- console.log(`Found ${runs.workflow_runs.length} completed runs today, ${successfulTodayRuns.length} successful`);
82- core.setOutput('success', hasSuccessfulRunToday.toString());
54+ - name : Check PyPI package update
55+ id : check-pypi
56+ run : |
57+ # Get today's date in ISO format for comparison
58+ TODAY=$(date -u +"%Y-%m-%d")
59+ echo "Today's date: $TODAY"
60+
61+ # Query PyPI API for the langflow package
62+ HTTP_STATUS=$(curl -s -o response.json -w "%{http_code}" https://pypi.org/pypi/langflow-nightly/json)
63+
64+ # Check HTTP status code first
65+ if [ "$HTTP_STATUS" -ne 200 ]; then
66+ echo "Error: PyPI API returned HTTP status $HTTP_STATUS"
67+ echo "success=false" >> $GITHUB_OUTPUT
68+ exit 0
69+ fi
70+
71+ # Check if response is valid JSON before proceeding
72+ if ! jq -e . response.json >/dev/null 2>&1; then
73+ echo "Error: Invalid JSON response from PyPI API"
74+ echo "Response preview:"
75+ head -n 10 response.json
76+ echo "success=false" >> $GITHUB_OUTPUT
77+ exit 0
78+ fi
79+
80+ # Extract the latest version
81+ LATEST_VERSION=$(jq -r '.info.version // empty' response.json)
82+
83+ if [ -z "$LATEST_VERSION" ]; then
84+ echo "Could not extract latest version"
85+ echo "success=false" >> $GITHUB_OUTPUT
86+ exit 0
87+ fi
88+
89+ # Extract the release date of the latest version
90+ RELEASE_DATE=$(jq -r --arg ver "$LATEST_VERSION" '.releases[$ver][0].upload_time_iso_8601 // empty' response.json | cut -d'T' -f1)
91+
92+ if [ -z "$RELEASE_DATE" ]; then
93+ echo "Could not extract release date"
94+ echo "success=false" >> $GITHUB_OUTPUT
95+ exit 0
96+ fi
97+
98+ echo "Latest version: $LATEST_VERSION"
99+ echo "Release date: $RELEASE_DATE"
100+
101+ # Check if the release date is today
102+ if [[ "$RELEASE_DATE" == "$TODAY" ]]; then
103+ echo "Package was updated today"
104+ echo "success=true" >> $GITHUB_OUTPUT
105+ else
106+ echo "Package was not updated today"
107+ echo "success=false" >> $GITHUB_OUTPUT
108+ fi
109+
110+ # Clean up
111+ rm -f response.json
83112
84113 set-ci-condition :
85114 needs : check-nightly-status
86115 name : Should Run CI
87116 runs-on : ubuntu-latest
88117 outputs :
89118 should-run-ci : ${{ (needs.check-nightly-status.outputs.should-proceed == 'true' || github.event_name == 'workflow_dispatch') && ((contains( github.event.pull_request.labels.*.name, 'lgtm') && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' || github.event_name == 'merge_group')) }}
119+ should-run-tests : ${{ !contains(github.event.pull_request.labels.*.name, 'fast-track') || github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' }}
90120 steps :
91121 # Do anything just to make the job run
92122 - run : echo "Debug CI Condition"
93123 - run : echo "Labels -> ${{ join(github.event.pull_request.labels.*.name, ',') }}"
94124 - run : echo "IsDraft -> ${{ github.event.pull_request.draft }}"
95125 - run : echo "Event name -> ${{ github.event_name }}"
96126 - run : echo "Nightly build status -> ${{ needs.check-nightly-status.outputs.should-proceed }}"
127+ - run : echo "Should run tests -> ${{ !contains(github.event.pull_request.labels.*.name, 'fast-track') || github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' }}"
97128
98129 path-filter :
99130 needs : set-ci-condition
@@ -125,16 +156,17 @@ jobs:
125156 filters : ./.github/changes-filter.yaml
126157
127158 test-backend :
128- needs : path-filter
159+ needs : [ path-filter, set-ci-condition]
129160 name : Run Backend Tests
130- if : ${{ needs.path-filter.outputs.python == 'true'}}
161+ if : ${{ needs.path-filter.outputs.python == 'true' && needs.set-ci-condition.outputs.should-run-tests == 'true' }}
131162 uses : ./.github/workflows/python_test.yml
132163 with :
133164 python-versions : ${{ inputs.python-versions || '["3.10"]' }}
165+
134166 test-frontend :
135- needs : path-filter
167+ needs : [ path-filter, set-ci-condition]
136168 name : Run Frontend Tests
137- if : ${{ needs.path-filter.outputs.frontend == 'true' || needs.path-filter.outputs.frontend-tests == 'true' || needs.path-filter.outputs.components-changes == 'true' || needs.path-filter.outputs.starter-projects-changes == 'true' || needs.path-filter.outputs.starter-projects == 'true' || needs.path-filter.outputs.components == 'true' || needs.path-filter.outputs.workspace == 'true' || needs.path-filter.outputs.api == 'true' || needs.path-filter.outputs.database == 'true' }}
169+ if : ${{ ( needs.path-filter.outputs.frontend == 'true' || needs.path-filter.outputs.frontend-tests == 'true' || needs.path-filter.outputs.components-changes == 'true' || needs.path-filter.outputs.starter-projects-changes == 'true' || needs.path-filter.outputs.starter-projects == 'true' || needs.path-filter.outputs.components == 'true' || needs.path-filter.outputs.workspace == 'true' || needs.path-filter.outputs.api == 'true' || needs.path-filter.outputs.database == 'true') && needs.set-ci-condition.outputs.should-run-tests == 'true' }}
138170 uses : ./.github/workflows/typescript_test.yml
139171 with :
140172 tests_folder : ${{ inputs.frontend-tests-folder }}
@@ -167,18 +199,21 @@ jobs:
167199 lint-backend,
168200 test-docs-build,
169201 set-ci-condition,
202+ path-filter
170203 ]
171204
172205 if : always()
173206 runs-on : ubuntu-latest
174207 env :
175208 JOBS_JSON : ${{ toJSON(needs) }}
176209 RESULTS_JSON : ${{ toJSON(needs.*.result) }}
177- EXIT_CODE : ${{!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && needs.set-ci-condition.outputs.should-run-ci == 'true' && ' 0' || '1'}}
210+ EXIT_CODE : ${{ (( !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && needs.set-ci-condition.outputs.should-run-ci == 'true') || (needs.set-ci-condition.outputs.should-run-tests == 'false' && needs.set-ci-condition.outputs.should-run-ci == 'true')) && ' 0' || '1' }}
178211 steps :
179212 - name : " CI Success"
180213 run : |
181214 echo $JOBS_JSON
182215 echo $RESULTS_JSON
216+ echo "Should run tests: ${{ needs.set-ci-condition.outputs.should-run-tests }}"
217+ echo "Should run CI: ${{ needs.set-ci-condition.outputs.should-run-ci }}"
183218 echo "Exiting with $EXIT_CODE"
184219 exit $EXIT_CODE
0 commit comments