fix(ci): Replace tj-actions/changed-files with dorny/paths-filter in seed-dockers workflow#10516
Conversation
…seed-dockers workflow The workflow was failing with 'fromJSON: Unexpected symbol: docker' because tj-actions/changed-files outputs space-delimited file paths, not JSON. This commit replaces it with dorny/paths-filter which outputs a JSON array of filter names directly, fixing the fromJSON error and simplifying the conditional checks. Co-Authored-By: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Let's keep using ./.github/actions/check-for-changed-files instead, and use the non-JSON output, update the logic not to use JSON |
|
Thanks for the feedback! I'll update the approach to keep using Here's the plan:
This way we avoid JSON parsing of the changed-files output entirely, and only use JSON for the matrix definition (which GitHub Actions requires). I'll also need to confirm: should changes to Working on this now! |
Per feedback, this keeps the existing ./.github/actions/check-for-changed-files action instead of replacing it with dorny/paths-filter. Changes: - Restore original check-for-changed-files action with fetch-depth: 200 - Add derive step to convert space-delimited file paths to package names - Output both packages_json (JSON array for matrix) and packages_space (space-delimited for conditions/loops) - Update conditional checks to use packages_space != '' instead of JSON parsing - Update merge-manifests loop to use space-delimited list instead of jq - Workflow changes now trigger rebuilds for all images (ts, java, python, csharp) This avoids JSON parsing of the changed-files output entirely. JSON is only used for the matrix definition (which GitHub Actions requires). Co-Authored-By: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com>
|
How are other workflows doing filtering based on paths and triggering specific jobs only if files changed? Mimic their logic |
|
Good point! I'll switch to the same pattern used in
This will match the existing patterns in the repository. Working on this now! |
Per feedback, this mimics the existing pattern used in seed.yml and other workflows instead of creating custom shell scripts. Changes: - Replace custom shell script with multiple check-for-changed-files calls (one per package) - Use boolean outputs (ts, java, python, csharp) from any_changed - Add Set outputs step that sets all to true if workflow file changed - Use static matrix [ts, java, python, csharp] with boolean gating in build-container - Build space-delimited list from booleans in merge-manifests (no JSON, no jq) - Workflow changes trigger rebuilds for all images This matches the boolean-based gating pattern used throughout the repository and avoids custom JSON/shell parsing entirely. Co-Authored-By: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com>
|
Make sure you only build the images that have changed |
|
The implementation does build only changed images! The boolean gating logic works like this: build-container job (line 91):
merge-manifests job (lines 158-175):
This matches the pattern from One question: Should |
|
For manual, let us choose which seed containers to rebuild from input |
|
Good idea! I'll add workflow_dispatch inputs to allow selecting which seed containers to rebuild:
This way you can manually trigger the workflow and choose exactly which containers to rebuild. Working on this now! |
Per feedback, this adds manual inputs to allow selecting which seed containers to rebuild when manually triggering the workflow. Changes: - Add workflow_dispatch inputs: all, ts, java, python, csharp (all boolean) - Update Set outputs step to branch on github.event_name - For workflow_dispatch: use inputs to set package booleans - For push events: keep existing path-based change detection - If inputs.all is true, rebuild all images - Otherwise, rebuild only selected packages from inputs This allows manual runs to choose exactly which containers to rebuild while keeping automatic path-based detection for push events. Co-Authored-By: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com>
Description
Fixes the
seed-dockers.ymlworkflow which was failing with:The workflow attempted to use
fromJSON()on space-delimited file paths fromcheck-for-changed-files. This PR implements boolean-based gating following the pattern fromseed.yml, and adds manual workflow_dispatch inputs to select which containers to rebuild.Link to Devin run: https://app.devin.ai/sessions/97f8791d44cc4778a0f3b4acc0a9f1dd
Requested by: Niels Swimberghe (@Swimburger)
Changes Made
Core Architecture Change:
build-containerjob into four separate jobs (build-ts,build-java,build-python,build-csharp)if: needs.changes.outputs.<pkg> == 'true'conditionrunner×archdimensionsmatrix.*references in job-levelifconditionsChange Detection (lines 42-117):
check-for-changed-filescall with separate calls per package + workflow filets,java,python,csharp)github.event_name:workflow_dispatch: Uses manual inputs to set booleanspush: Uses path-based change detection withany_changedoutputstrue(rebuilds everything)Manual Trigger Support (lines 10-31):
workflow_dispatchinputs:all,ts,java,python,csharp(all boolean)allinput rebuilds everything for convenienceManifest Merging (lines 325-371):
merge-manifeststo depend on all four build jobsjqJSON parsing, uses simple bash iterationTesting
mainbranch with changes todocker/seed/*or the workflow fileworkflow_dispatchThe implementation follows the exact pattern from
seed.yml(lines 291-984) which uses separate jobs per language with boolean-based gating.Review Checklist
Critical items to verify:
Job-level if conditions (lines 129, 179, 228, 277): Each build job correctly checks
needs.changes.outputs.<pkg> == 'true'. Note the string comparison with quotes.Job dependencies (line 327):
merge-manifestsdepends on all four build jobs. Verify this works correctly when some jobs are skipped (GitHub Actions should handle this, but worth confirming).String comparison format: Confirm that
check-for-changed-filesoutputsany_changedas the string"true"(not booleantrue), so comparisons like== 'true'work correctly.Manual input handling (lines 87-101): Verify the logic for
workflow_dispatchinputs:inputs.all == true: rebuilds all imagesWorkflow rebuild behavior (lines 104-109): Changes to
.github/workflows/seed-dockers.ymlnow trigger rebuilds of ALL images. Confirm this is desired behavior.Package names consistency: Verify package names (
ts,java,python,csharp) match Dockerfile suffixes (e.g.,Dockerfile.ts,Dockerfile.java).Matrix exclusions (lines 134-140, etc.): Confirm runner/arch exclusions still work correctly with the new job structure.
Risks: