Skip to content

Skip uninvolved CI jobs on cross-stack publish pushes#4548

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/improve-ci-speed-for-publish
Draft

Skip uninvolved CI jobs on cross-stack publish pushes#4548
Copilot wants to merge 3 commits into
mainfrom
copilot/improve-ci-speed-for-publish

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

  • Re-check current workflow files and run baseline YAML lint on target CI workflows
  • Replace changed-file based publishing detection with non-dev VERSION state detection in each request job (actions.yml, bazel.yml, docker.yml, py.yml, rust.yml)
  • Reformat bash logic in each publishing step to 4-space indentation style
  • Keep request/status and existing should-run/path-filter logic unchanged; only adjust publishing step logic
  • Re-run YAML lint on modified workflows and review diffs for correctness
  • Run parallel validation and address feedback
Original prompt

Problem

On push to main, when one of the publishable stacks goes non-dev (i.e. its VERSION.txt is bumped to a non-dev version), _publish.yml is triggered via workflow_run after each of the five CI workflows (Bazel CI, Docker CI, Github/actions CI, Python CI, Rust CI) completes, and waits on all five to complete before publishing (see _publish.yml#L131-L138).

This means a publish of e.g. actions ends up waiting for full Bazel/Docker/Python/Rust CI runs that have nothing to do with the publish, making publishes very slow.

Goal

When stack X is publishing (its VERSION bumped to non-dev) and stack Y is not, Y's CI should internally skip its heavy jobs so its workflow run completes quickly. The waiting structure in _publish.yml stays unchanged — we just make the "uninvolved" CI runs finish in ~30s (only the request job runs).

This must be done purely via an additional step in each CI yaml file — do NOT modify the actions/github/should-run composite action.

Rule

On push events only:

If any "other-stack" VERSION.txt changed in this push AND no "self" VERSION.txt changed, force-skip the heavy jobs in this workflow.

On pull_request events the new step must be a no-op — PR CI continues to behave exactly as today.

Stack ↔ VERSION file ownership

CI workflow "self" VERSION files
actions.yml actions/VERSION.txt
bazel.yml bazel/VERSION.txt, BINS_VERSION.txt
docker.yml docker/build/VERSION.txt
py.yml py/VERSION.txt
rust.yml BINS_VERSION.txt

"Others" for a given workflow = the union of all the above minus that workflow's self set.

Note: BINS_VERSION.txt is "self" for both bazel.yml and rust.yml because _publish.yml lists both Bazel CI and Rust CI under bins' artifact-workflows (_publish.yml#L160-L168).

Implementation

For each of the 5 workflow files (actions.yml, bazel.yml, docker.yml, py.yml, rust.yml):

  1. In the request job, after the existing should-run step (which already does actions/checkout@... fetch-depth: 0, see should-run/action.yml#L42-L45), add a new step id: publishing that runs only when github.event_name == 'push'. It uses git diff --name-only HEAD^1 HEAD (matching what should-run itself does on push, see should-run/action.yml#L52-L57) to classify changed files into self_changed and others_changed via a case statement, then sets skip=true to $GITHUB_OUTPUT only if others_changed == true && self_changed == false. Otherwise skip=false.

  2. Expose skip-publishing: ${{ steps.publishing.outputs.skip }} in the request job's outputs:.

  3. Add && needs.request.outputs.skip-publishing != 'true' to the if: expression of every heavy job in that workflow (i.e. every job that currently gates on fromJSON(needs.request.outputs.run)). Do NOT add it to the status job (which is already pull_request-only) and do NOT add it to the request job itself.

Snippet template (adapt the case arms per workflow)

    - name: Detect cross-stack publish
      id: publishing
      if: github.event_name == 'push'
      shell: bash
      run: |
        # should-run already ran actions/checkout with fetch-depth: 0
        changed="$(git diff --name-only HEAD^1 HEAD)"
        self_changed=false
        others_changed=false
        while IFS= read -r f; do
          case "$f" in
            # <SELF FILES>) self_changed=true ;;
            # <OTHER FILES>) others_changed=true ;;
          esac
        done <<< "$changed"
        if [[ "$others_changed" == "true" && "$self_changed" == "false" ]]; then
          echo "skip=true" >> "$GITHUB_OUTPUT"
          echo "Other stack(s) publishing - skipping heavy jobs"
        else
          echo "skip=false" >> "$GITHUB_OUTPUT"
        fi

Per-workflow case arms

actions.yml

case "$f" in
  actions/VERSION.txt) self_changed=true ;;
  bazel/VERSION.txt|BINS_VERSION.txt|docker/build/VERSION.txt|py/VERSION.txt)
    others_changed=true ;;
esac

Heavy jobs to gate: actions.

bazel.yml

case "$f" in
  bazel/VERSION.txt|BINS_VERSION.txt) self_changed=true ;;
  actions/VERSION.txt|docker/build/VERSION.txt|py/VERSION.txt)
    others_changed=true ;;
esac

Heavy jobs to gate: test, build, test-gcc, test-macos.

docker.yml

case "$f" i...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 01efae8
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/6a072c61c5e6cf0007697599
😎 Deploy Preview https://deploy-preview-4548--nifty-bassi-e26446.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Optimize CI workflows to reduce publish wait times Skip uninvolved CI jobs on cross-stack publish pushes May 15, 2026
Copilot finished work on behalf of phlax May 15, 2026 14:18
Copilot AI requested a review from phlax May 15, 2026 14:18
Copilot finished work on behalf of phlax May 15, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants