Consider we Have 10 Docker files but i made some changes only in 1 Docker file.so In Github action we generally build all 10 docker files instead of 1 docker file. So Is there any way to write conditions such that github actions should build that particular dockerfile which we made changes.
You can try to use this github action: https://github.com/trilom/file-changes-action
Go over the docs to see how to use it. But basically an example would be similar to this:
- name: Get file changes
id: get_file_changes
uses: trilom/file-changes-action@v1.2.3
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
plaintext: true
- name: Echo file changes
run: |
echo Changed files: ${{ steps.get_file_changes.outputs.files }}
- name: do something on the changed files ussing ${{ steps.get_file_changes.outputs.files }}
.
.
.
Hope that helps