Skip to content

Commit

Permalink
Refactoring/improve comments and readme (#15)
Browse files Browse the repository at this point in the history
* Explain why PR trigger event does not push new container image to registry

* Update README

* Specify explicitly push and eventFilterForPush for educational purposes
  • Loading branch information
dantp-ai authored Aug 17, 2024
1 parent e6a51a2 commit 81ed6d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/lint-format-typecheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ jobs:
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/${{ secrets.GH_DOCKER_REGISTRY_NAMESPACE }}/${{ vars.CONTAINER_IMAGE_NAME }}
# Push new container image if `eventFilterForPush` and `refFilterForPush` (by default allow all branches to trigger a push of the container image) are true
push: filter
# Push new image only if event name that triggered this workflow matches `push`
# If a pull request triggered it, then skip pushing new container image to registry
eventFilterForPush: push
runCmd: |
poetry run ruff check --fix
poetry run ruff format .
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ jobs:
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/${{ secrets.GH_DOCKER_REGISTRY_NAMESPACE }}/${{ vars.CONTAINER_IMAGE_NAME }}
push: filter
eventFilterForPush: push
runCmd: |
poetry run pytest
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Note that in step 3, the devcontainer is not rebuilt, but reused from the latest

### 2. Open a PR with a new feature

Similar to scenario 1, but pushing new devcontainer image is _skipped_ because the code changes are not merged to main ([see specification of](https://github.com/devcontainers/ci/blob/main/docs/github-action.md#inputs) `push` and `eventFilterForPush` inputs for `devcontainer/ci` action).
Similar to scenario 1, but pushing new devcontainer image is _skipped_ because the workflow has not been triggered by a push to main, rather a PR event (for more [see specification of](https://github.com/devcontainers/ci/blob/main/docs/github-action.md#inputs) `push`, `refFilterForPush`, and `eventFilterForPush` (default) inputs for `devcontainer/ci` action).

### 3. Add new Python libraries to the list of existing dependencies

If we were to add a new Python library as part of our development, in step 4 of scenario 1 we would not get the virtual environment from the cache, but we would use the newly created one with the additional library and _push_ it to the cache.
If we were to add a new Python library as part of our development, in step 4 of scenario 1 we would not get the virtual environment from the cache, but we would use the newly created one with the additional library and _push_ it to the cache.

0 comments on commit 81ed6d6

Please sign in to comment.