Skip to content

ci: skip docker-build on PRs that don't change Docker/deps#4

Closed
jmponcebe wants to merge 1 commit into
mainfrom
ci/skip-docker-build-when-unchanged
Closed

ci: skip docker-build on PRs that don't change Docker/deps#4
jmponcebe wants to merge 1 commit into
mainfrom
ci/skip-docker-build-when-unchanged

Conversation

@jmponcebe
Copy link
Copy Markdown
Owner

Adds dorny/paths-filter to detect changes and only runs docker-build when:

  • docker/** changes
  • pyproject.toml, uv.lock or
    equirements.txt change
  • .github/workflows/ci.yml changes
  • commit message contains [docker]`n
    Python-only PRs now skip the ~6-10 min Docker build. CD on tags (deploy.yml + cloudbuild.yaml) is unaffected.

Uses dorny/paths-filter to detect changes in docker/, pyproject.toml, uv.lock, requirements.txt or ci.yml.

PRs that only touch Python code will skip the ~6-10 min Docker build. To force a build, include '[docker]' in the commit message.
Copilot AI review requested due to automatic review settings April 21, 2026 10:16
@jmponcebe jmponcebe closed this Apr 21, 2026
@jmponcebe jmponcebe deleted the ci/skip-docker-build-when-unchanged branch April 21, 2026 10:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CI workflow to skip the Docker image build on PRs unless Docker-related files (or dependency manifests) change, reducing CI runtime for Python-only changes.

Changes:

  • Add a changes job using dorny/paths-filter to detect Docker-relevant file modifications.
  • Gate docker-build on the changes job output (and an attempted [docker] override).

Comment thread .github/workflows/ci.yml
if: >
github.event_name == 'pull_request' ||
needs.changes.outputs.docker == 'true' ||
contains(github.event.head_commit.message, '[docker]')
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github.event.head_commit.message isn't available for this workflow's triggers (pull_request and workflow_call). With the new condition, Python-only PRs will evaluate contains(github.event.head_commit.message, '[docker]') and the expression can error or never match, so the job gating won't work as intended. Consider switching the override to PR metadata (e.g., github.event.pull_request.title/body) or guarding/null-coalescing the value (e.g., contains(github.event.head_commit.message || '', '[docker]')) and/or computing a force_docker output in the changes job from git log -1.

Suggested change
contains(github.event.head_commit.message, '[docker]')
contains(github.event.head_commit.message || '', '[docker]')

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines 82 to +86
docker-build:
runs-on: ubuntu-latest
needs: lint-and-test
needs: [lint-and-test, changes]
if: >
github.event_name == 'pull_request' ||
needs.changes.outputs.docker == 'true' ||
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because ci.yml is called from deploy.yml via workflow_call on version tags, this new changes/docker-build gating will also be evaluated during CD. If Docker builds are meant to be PR-only (as the PR description suggests), consider guarding these jobs with if: github.event_name == 'pull_request' or adding a workflow input to disable docker builds for CD invocations.

Copilot uses AI. Check for mistakes.
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