Skip to content

Commit fc728b7

Browse files
committed
ci(pr-checks): integrate changed-files action for selective Docker builds
Leverage tj-actions/changed-files@v46 to check Dockerfile modifications, eliminating custom git diff and ensuring image builds only for relevant PR changes
1 parent 9a20e1f commit fc728b7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/pr-checks.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,21 @@ jobs:
2525
uses: actions/checkout@v5
2626
with:
2727
fetch-depth: 0
28+
29+
- name: Detect changed files
30+
id: changed-files
31+
uses: tj-actions/changed-files@v46
32+
with:
33+
files: |
34+
Dockerfile
35+
2836
- name: Setup toolchain with mise
2937
uses: jdx/mise-action@v2
3038

3139
- name: Run prek hooks
3240
run: prek run --all-files --show-diff-on-failure --color=always
3341

3442
- name: Build Docker image if Dockerfile changed
43+
if: steps.changed-files.outputs.any_changed == 'true'
3544
run: |
36-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q '^Dockerfile$'; then
37-
echo "Dockerfile changed — building image..."
38-
docker build -t opencode-cli-pr:latest .
39-
else
40-
echo "Dockerfile not changed — skipping build."
41-
fi
45+
docker build -t opencode-cli-pr:latest .

0 commit comments

Comments
 (0)