Add selective CI triggering based on changed files.#18
Conversation
Add `detect_changes` job using tj-actions/changed-files@v47.0.4 (pinned to SHA 7dee1b0c1557f278e5c7dc244927139d78c0e22a) to skip `build_image` when no relevant files are changed. `build_image` now runs only when: - docker/greenplum/**/6/** files are modified - docker/files/entrypoint.sh or docker/files/start_gpdb.sh are modified - .github/workflows/build-gpdb6.yml is modified - push to master or a tag is pushed
… selective build triggering.
… for selective build triggering.
There was a problem hiding this comment.
Pull request overview
This PR adds selective CI triggering to avoid unnecessary Docker image builds when unrelated files change. A detect_changes job now runs before build_image to determine if relevant files were modified, and build_image only executes when project-specific files, common scripts, the workflow itself, or pushes to master/tags occur.
Changes:
- Added
detect_changesjob usingtj-actions/changed-files@v47.0.4(pinned to SHA) to detect file changes - Modified
build_imagejob to depend ondetect_changesand conditionally run based on changed files or branch/tag - Applied identical pattern across all seven workflow files (gpdb6/7, greengage6/7, opengpdb6, warehousepg6/7)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/build-warehousepg7.yml | Added change detection for warehousepg version 7 files |
| .github/workflows/build-warehousepg6.yml | Added change detection for warehousepg version 6 files |
| .github/workflows/build-opengpdb6.yml | Added change detection for opengpdb version 6 files with opengpdb-specific script path |
| .github/workflows/build-greengage7.yml | Added change detection for greengage version 7 files |
| .github/workflows/build-greengage6.yml | Added change detection for greengage version 6 files |
| .github/workflows/build-gpdb7.yml | Added change detection for greenplum version 7 files |
| .github/workflows/build-gpdb6.yml | Added change detection for greenplum version 6 files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [[ "${{ steps.changed-files.outputs.project_any_changed }}" == "true" || \ | ||
| "${{ steps.changed-files.outputs.common_any_changed }}" == "true" || \ | ||
| "${{ github.ref }}" == "refs/heads/master" || \ | ||
| "${{ github.ref }}" == refs/tags/* ]]; then |
There was a problem hiding this comment.
The refs/tags/* pattern is not quoted in the shell comparison. This will cause the glob pattern to be expanded by the shell instead of being treated as a literal string for comparison. Add quotes around 'refs/tags/*' to match the pattern correctly.
| "${{ github.ref }}" == refs/tags/* ]]; then | |
| "${{ github.ref }}" == "refs/tags/*" ]]; then |
| if [[ "${{ steps.changed-files.outputs.project_any_changed }}" == "true" || \ | ||
| "${{ steps.changed-files.outputs.common_any_changed }}" == "true" || \ | ||
| "${{ github.ref }}" == "refs/heads/master" || \ | ||
| "${{ github.ref }}" == refs/tags/* ]]; then |
There was a problem hiding this comment.
The refs/tags/* pattern is not quoted in the shell comparison. This will cause the glob pattern to be expanded by the shell instead of being treated as a literal string for comparison. Add quotes around 'refs/tags/*' to match the pattern correctly.
| "${{ github.ref }}" == refs/tags/* ]]; then | |
| "${{ github.ref:0:10 }}" == "refs/tags/" ]]; then |
| if [[ "${{ steps.changed-files.outputs.project_any_changed }}" == "true" || \ | ||
| "${{ steps.changed-files.outputs.common_any_changed }}" == "true" || \ | ||
| "${{ github.ref }}" == "refs/heads/master" || \ | ||
| "${{ github.ref }}" == refs/tags/* ]]; then |
There was a problem hiding this comment.
The refs/tags/* pattern is not quoted in the shell comparison. This will cause the glob pattern to be expanded by the shell instead of being treated as a literal string for comparison. Add quotes around 'refs/tags/*' to match the pattern correctly.
| "${{ github.ref }}" == refs/tags/* ]]; then | |
| "${{ github.ref }}" == "refs/tags/*" ]]; then |
| if [[ "${{ steps.changed-files.outputs.project_any_changed }}" == "true" || \ | ||
| "${{ steps.changed-files.outputs.common_any_changed }}" == "true" || \ | ||
| "${{ github.ref }}" == "refs/heads/master" || \ | ||
| "${{ github.ref }}" == refs/tags/* ]]; then |
There was a problem hiding this comment.
The refs/tags/* pattern is not quoted in the shell comparison. This will cause the glob pattern to be expanded by the shell instead of being treated as a literal string for comparison. Add quotes around 'refs/tags/*' to match the pattern correctly.
| "${{ github.ref }}" == refs/tags/* ]]; then | |
| "${{ github.ref }}" == 'refs/tags/*' ]]; then |
| if [[ "${{ steps.changed-files.outputs.project_any_changed }}" == "true" || \ | ||
| "${{ steps.changed-files.outputs.common_any_changed }}" == "true" || \ | ||
| "${{ github.ref }}" == "refs/heads/master" || \ | ||
| "${{ github.ref }}" == refs/tags/* ]]; then |
There was a problem hiding this comment.
The refs/tags/* pattern is not quoted in the shell comparison. This will cause the glob pattern to be expanded by the shell instead of being treated as a literal string for comparison. Add quotes around 'refs/tags/*' to match the pattern correctly.
| if [[ "${{ steps.changed-files.outputs.project_any_changed }}" == "true" || \ | ||
| "${{ steps.changed-files.outputs.common_any_changed }}" == "true" || \ | ||
| "${{ github.ref }}" == "refs/heads/master" || \ | ||
| "${{ github.ref }}" == refs/tags/* ]]; then |
There was a problem hiding this comment.
The refs/tags/* pattern is not quoted in the shell comparison. This will cause the glob pattern to be expanded by the shell instead of being treated as a literal string for comparison. Add quotes around 'refs/tags/*' to match the pattern correctly.
| "${{ github.ref }}" == refs/tags/* ]]; then | |
| "${{ github.ref }}" == "refs/tags/"* ]]; then |
| if [[ "${{ steps.changed-files.outputs.project_any_changed }}" == "true" || \ | ||
| "${{ steps.changed-files.outputs.common_any_changed }}" == "true" || \ | ||
| "${{ github.ref }}" == "refs/heads/master" || \ | ||
| "${{ github.ref }}" == refs/tags/* ]]; then |
There was a problem hiding this comment.
The refs/tags/* pattern is not quoted in the shell comparison. This will cause the glob pattern to be expanded by the shell instead of being treated as a literal string for comparison. Add quotes around 'refs/tags/*' to match the pattern correctly.
Add
detect_changesjob to workflows to skipbuild_imagewhen no relevant files are changed.Uses
tj-actions/changed-files@v47.0.4(pinned to SHA7dee1b0c) withfetch-depth: 0for full git history.build_imageruns only when:entrypoint.sh,start_gpdb.sh);masteror a tag push;