File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,8 +143,7 @@ jobs:
143143 docker-build :
144144 name : Build and Push Docker Test Image
145145 runs-on : ubuntu-latest
146- # Only run on pushes to main when Docker files change
147- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
146+ if : github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
148147 permissions :
149148 contents : read
150149 packages : write
@@ -161,18 +160,20 @@ jobs:
161160 - 'docker-compose.yml'
162161
163162 - name : Log in to GitHub Container Registry
164- if : steps.changes.outputs.docker == 'true'
163+ if : steps.changes.outputs.docker == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
165164 uses : docker/login-action@v3
166165 with :
167166 registry : ghcr.io
168167 username : ${{ github.actor }}
169168 password : ${{ secrets.GITHUB_TOKEN }}
170169
171- - name : Build and push Docker image
170+ - name : Build Docker image
172171 if : steps.changes.outputs.docker == 'true'
173- run : |
174- docker compose build
175- docker compose push
172+ run : docker compose build
173+
174+ - name : Push Docker image
175+ if : steps.changes.outputs.docker == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
176+ run : docker compose push
176177
177178 test-shellspec-linux :
178179 name : ShellSpec Tests (Linux)
You can’t perform that action at this time.
0 commit comments